mod_rewrite - 需要有关友好 URL 的帮助
你会如何mod_rewrite从directory.php转到url
?id=4 到 directory/category/city/name/4/
我在黑暗中尝试了一下,
RewriteRule ^directory/*/*/*/([^/\.]+)/?$ directory.php?&id=$4
但显然没有工作。非常感谢任何帮助
How would you mod_rewrite a url to go from
directory.php?id=4
to
directory/category/city/name/4/
I took a stab in the dark with
RewriteRule ^directory/*/*/*/([^/\.]+)/?$ directory.php?&id=$4
But not working obviously. Any help is greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样:
括号执行捕获,并且由于您只执行一次捕获,因此可以在目标中使用“$1”。
编辑:我假设您希望不带查询字符串的 URL 重定向到带查询字符串的 URL(您的问题不是 100% 清楚,听起来好像是相反的情况)
How about:
The parentheses do the capture, and since you are only doing one capture, then the can use '$1' in the target.
Edit: I'm assuming that you want the URL without the query string to redirect to the one with the query string (not 100% clear in your question, sounds like it is the other way around)