我如何避免并允许 htaccess 中的子目录
.htaccess以下网址
http://www.mydomain.com/user.php?id=username
我希望通过
http://www.mydomain.com/username
...
我也想避免子目录名称冲突... 我有一个重写规则,
RewriteRule ^home/$ home.php?id=$1 [NC,L]
即我的网址变为 http://www.mydomain.com/home/ 所以我希望这个家被忽略......在 http://www.mydomain.com/username
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重写规则按照它们出现的顺序进行评估。因此,只需将您的主目录重写规则放在第一位,然后将您的用户名重写规则放在第二位,如下所示:
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: