我已將網站移至新域,並且我使用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