mod_rewrite的{QUERY_STRING} [英] mod_rewrite {QUERY_STRING}
本文介绍了mod_rewrite的{QUERY_STRING}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我敢肯定这是被问不计其数次,但我不能让它工作, 我试图重写URL与查询字符串,我的网址,例如:
http://example.com/articles/index.php?keyword=book
和我想从
可以访问 http://example.com/articles/keyword/book/
我谷歌,而我没有任何侥幸, 我是在正确的轨道?我得到这样的:
的RewriteCond%{QUERY_STRING} ^关键字=(。*)$ [NC]
重写规则^ /用品/ index.php的$ /用品/关键字/ $ 1 [NC,L,R = 301]
更新
这是工作的罚款
RewriteEngine叙述上
选项+的FollowSymLinks
的RewriteBase /
重写规则^ * /(\ w +)\ B $ /articles/index.php?keyword=$1
解决方案
这应该工作:
重写规则^文章/关键字/(.*)/?$的index.php?关键字= $ 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
解决方案
It should work:
RewriteRule ^articles/keyword/(.*)/?$ index.php?keyword=$1
If not, please tell me ;)
这篇关于mod_rewrite的{QUERY_STRING}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文