mod_rewrite的{QUERY_STRING}mod_rewrite、QUERY_STRING

2023-09-02 11:41:15 作者:垫脚望北

我敢肯定这是被问不计其数次,但我不能让它工作, 我试图重写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]
 
C2服务隐藏

更新

这是工作的罚款

  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 ;)

 
精彩推荐
图片推荐