我已将网站移至新域,并且我使用RewriteRule
重定向了我的一些网址。如何使用查询字符串重定向URL
我被卡住了试图用查询字符串重定向URL吗?
RewriteRule /news/archive.php?cat=economic-impact http://www.new-website.com/faqs/economic-impact [R=301,L]
RewriteRule /news/archive.php?cat=housing-need http://www.new-website.com/faqs/housing-need R=301,L]
RewriteRule /news/archive.php?cat=infrastructure http://www.new-website.com/faqs/infrastructure R=301,L]
进一步向上htaccess
文件我用这个来重定向域
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-website.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.old-website.com$
RewriteRule (.*)$ http://www.new-website.com/$1 [R=301]
当我访问:
old-website.com/news/archive.php?cat=economic-impact
它重定向到
new-website.com/news/archive.php?cat=economic-impact
哪404s,我需要r转发到:
new-website.com/faqs/economic-impact
任何人都可以帮忙吗?
你需要它仅适用于上述这些字符串3或你想'/新闻/ archive.php?cat =任何东西'重定向到'http:// www.new-website.com/faqs/anything'? –
[htaccess重定向与querystring]可能重复(http://stackoverflow.com/questions/6383574/htaccess-redirection-with-querystring) – Walf