.htaccess에 다음 코드가 있습니다.Apache mod_rewrite 모듈 문제
RewriteEngine On
RewriteRule ^/(\w+)/?$ /?user=$1
나는 http://domain.com/username에 http://domain.com/?user=username를 다시 작성하는 것을 시도하고있다. 불행히도이 코드는 아무 것도 다시 작성하지 않습니다. 제발 도와주세요
참고 : 나는 phpinfo()
을 확인했고 mod_rewrite가로드되었습니다.
업데이트
나는 http://facebook.com/username 같은 URL에서 사용자 이름을 얻을 필요가있다. 하지만이 코드는 루트 폴더의 모든 폴더를 다시 작성하므로 my/css 폴더는 http://domain.com/css/?u=common이됩니다. 이 코드는 http://domain.com/index.php
URL은 'http : //domain.com/user = username' (실제 URL)로 다시 쓰려고하는'http : // domain.com/username '과 같은 모양입니까? – ThinkingMonkey
@ InputMonkey 문제는 입력 및 출력 순서가 잘못 되었습니까? – treng
네 RewriteRule 괜찮을 것 같습니다. 브라우저에서 'http : // domain.com/username' URL에 액세스하려고하십니까? – ThinkingMonkey