ht 访问 mod_rewrite 查询字符串附加标志
我在 htaccess 中使用这两行将 /something
定向到 /page.php?page=something
。我希望将 /something?key=value
转换为 /page.php?page=something&key=value
。
这些线路似乎不起作用。
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [R,QSA]
RewriteRule ^([a-zA-Z0-9]+)$ /page.php?page=$1 [L,QSA]
关于如何改进这一点有什么想法吗?
I'm using these two lines in my htaccess to direct /something
to /page.php?page=something
. I'd like /something?key=value
to translate to /page.php?page=something&key=value
.
These lines do not seem to be working.
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([a-zA-Z0-9]+)/$ /$1 [R,QSA]
RewriteRule ^([a-zA-Z0-9]+)$ /page.php?page=$1 [L,QSA]
Any ideas on how to improve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经解决了这个问题。它实际上不起作用,因为 htaccess 文件中的另一条规则编写不正确。上面的代码工作正常。谢谢。
I've fixed the problem. It actually wasn't working because of another rule in the htaccess file which wasn't written correctly. The code above works fine. Thanks.