htaccess的重定向一个领域到另一个incliuding具体的查询字符串
问题描述:
基部我需要重定向
http://www.old-domain.com/news.php?NewsID=30888
到
http://www.new-domain.com/news.php?NewsID=30888
然而,使用htaccess的只有当查询字符串如上。任何其他查询STR 英格斯,我需要不断地去
http://www.old-domain.com/news.php?NewsID=whatever_querystring。
using htaccess however only if the query string is as above. Any other query strings I need to continue to go to
http://www.old-domain.com/news.php?NewsID=whatever_querystring.
所以,我需要匹配的30888,然后重定向到一个全新的网站,包括 news.php?NewSID的= 30888
。
So I need to match the 30888 and then redirect to a whole new site including the news.php?NewsID=30888
.
在此先感谢
答
将这个code在你的.htaccess,并尝试;
Put this code in your .htaccess and try;
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{QUERY_STRING} ^NewsID=30888 [NC]
RewriteCond %{HTTP_HOST} ^www\.old-domain\.com$ [NC]
RewriteRule ^ http://www.new-domain.com%{REQUEST_URI}?%{QUERY_STRING} [R=301,L]