mod_rewrite {QUERY_STRING}
我确信这个问题已经被问过无数次了,但我无法让它发挥作用, 我正在尝试用查询字符串重写一个网址,我的网址例如:
http://example.com/articles/index.php?keyword=book
并且我希望可以通过
http://example.com/articles/keyword/book/
谷歌访问它,但我没有任何运气, 我走在正确的轨道上吗?我得到这个:
RewriteCond %{QUERY_STRING} ^keyword=(.*)$ [NC]
RewriteRule ^/articles/index.php$ /articles/keyword/$1 [NC,L,R=301]
更新
这工作正常
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^.*/(\w+)\b$ /articles/index.php?keyword=$1
I'm sure that's been asked zillions times but i can't get it to work,
i'm trying to rewrite a url with querystring, my url is for example:
http://example.com/articles/index.php?keyword=book
and i want to be accessible from
http://example.com/articles/keyword/book/
I google it and i didn't have any luck,
am i on the right track? i got this:
RewriteCond %{QUERY_STRING} ^keyword=(.*)$ [NC]
RewriteRule ^/articles/index.php$ /articles/keyword/$1 [NC,L,R=301]
UPDATE
this is working fine
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^.*/(\w+)\b$ /articles/index.php?keyword=$1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它应该可以工作:
如果没有,请告诉我;)
It should work:
If not, please tell me ;)