0
내 웹 사이트에 친숙한 URL을 얻으려면 도움이 필요합니다. htaccess 친화적 인 URL의
이
내가 다시 작성해야 내 링크입니다 :www.example.com/index.php?page=pagename
www.example.com/index.php?page=profile&id=number
이 내 htaccess로합니다. 첫 번째 링크에서 문제를 해결했지만 두 번째 링크에서는 문제를 해결할 수 없습니다.
내가 두 번째 링크하고 싶은 :
www.example.com/profile/name or
www.example.com/profile/id
이 내 htaccess로 파일 : 내가 제출 한 위의 코드는 내 문제를 해결
# for www.example.com/index.php?page=profile&id=number
RewriteCond %{THE_REQUEST} \?page=([^&]+)&id=([0-9]+)
RewriteRule^/%1/%2? [L,R=301]
# for www.example.com/index.php?page=page
RewriteCond %{THE_REQUEST} \?page=([^&\ ]+)($|\)
RewriteRule^/%1? [L,R=301]
# rewrites back
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([0-9]+)$ /index.php?page=$1&id=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ /index.php?page=$1 [L]
.
를 들어 내가 코드를 추가 한 후이 링크를 가지고 : http://example.com/profile/206?page=profile&id = 206 – toofast
코드를 편집합니다. 지금은 괜찮습니까? – Croises
지금 두 링크가 작동하지 않습니다 : 페이지가 제대로 리디렉션되지 않습니다 – toofast