htaccess的重定向一个领域到另一个incliuding具体的查询字符串 [英] .htaccess redirect one domain to another incliuding specific query string

查看:96
本文介绍了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 tohttp://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]

这篇关于htaccess的重定向一个领域到另一个incliuding具体的查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆