需要重写 HTAccess
我需要将我的域中以 **/club/***anyPage* 开头的所有网址重写为 /page/club/anyPage。
为此,我相信我可以使用以下命令:
RewriteRule ^club/([^/]*)$ /page/club/$1 [NC]
另外,如果物理页不存在,我希望它有条件地重写,如下所示:
/club/$1 到 /page/club/club.php?title=$1
所以在这种情况下,如果用户进入 mysite.com/club/New_Club 他们实际上应该正在查看 /page/club/club.php?title=New_Club
I need to rewrite any url on my domain that starts with **/club/***anyPage* to /page/club/anyPage.
For this, I believe I can use the following command:
RewriteRule ^club/([^/]*)$ /page/club/$1 [NC]
Also, if the physical page does not exist I want it conditionally rewritten like so:
/club/$1 to /page/club/club.php?title=$1
So in this case if the user enters in mysite.com/club/New_Club they should actually be viewing /page/club/club.php?title=New_Club
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您原来的规则似乎可以正常工作,但是为了纳入第二个要求,类似这样的东西应该可以完成工作......
或者取决于其他规则......
Your original rules seems to work OK for it's job, but to encorporate the second requirement, something like this should do the job...
or depending on other rules...