开发者

301 Redirect of old url with parameters to a path without parametes

I need the following request :

http://somesite.com/home.php?action=page&page_id=9

to trigger a 301 redirect to :

http://somesite.com/a-new-page

Here's what I'm using but it isn't working.

RewriteCond %{QUERY_STRING} ^page_id=9$ [NC]
RewriteRule ^home\.php$ http://somesite.com/a开发者_如何学C-new-page? [L,R=301]

Any ideas?


If the QUERY_STRING will always be the same you need to match it like this:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^action=page&page_id=9$ [NC]
RewriteRule ^home.php$ http://somesite.com/a-new-page? [L,R=301]

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜