如何改进 htaccess 中的简单 mod_rewrite?
我正在使用 mod_rewrite 来获取干净的网址,但我只是遇到了一个小问题。
该行特别是:
RewriteRule ^events/(.*)$ fe_events.php?event_url=$1
这有效。我可以访问 url.com/events/something_or_other ,它会按预期工作。然而问题是,如果我只是访问 url.com/events ,它就不起作用 - 我必须访问 url.com/events/ (末尾有一个正斜杠)。
我可以简单地修改这一行还是需要添加另一行,例如:
RewriteRule ^events$ fe_events.php
感谢您的时间!
I am using mod_rewrite for clean urls but I'm just having a small problem.
The line in particular is:
RewriteRule ^events/(.*)$ fe_events.php?event_url=$1
This works. I can go to url.com/events/something_or_other and it works as expected. The problem however is then if I just go to url.com/events it doesn't work - I've got to go to url.com/events/ (with a trailing forward slash on the end).
Can I simply modify this line or do I need to add another line such as:
RewriteRule ^events$ fe_events.php
Thanks for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该有效。
this should work.