开发者

how can i avoid and allow subdirectories in htaccess

I want the following开发者_开发技巧 url

http://www.mydomain.com/user.php?id=username

to

http://www.mydomain.com/username

via .htaccess...

i also want to avoid subdirectory name conflict.... where i have a rewrite rule i.e

RewriteRule ^home/$ home.php?id=$1 [NC,L]

so my url become http://www.mydomain.com/home/ so i want this home to be ignored...in http://www.mydomain.com/username


Rewrite rules are evaluated in the order they appear. So just put your home rewrite rule first, and your username rewrite rule second, like this:

RewriteRule ^home/(.*)$ home.php?id=$1 [NC,L]

RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^user.php$ $1 [NC,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜