需要Apache重定向规则

时间:2011-03-09 10:25:16

标签: apache

我需要以如下所示的方式重定向网址。

  

HTTP:// 服务器1 / EM / 10_10_26_01_02的utm_content =顶加入,现在-LINK&放大器; utm_medium =网页版和放大器; utm_campaign =电子邮件-send2和放大器; utm_source = InfoUSA和放大器; CMPID = 778374938793 < / p>

  

HTTP:// 服务器2 / EM / 10_10_26_01_02的utm_content =顶加入,现在-LINK&放大器; utm_medium =网页版和放大器; utm_campaign =电子邮件-send2和放大器; utm_source = InfoUSA和放大器; CMPID = 778374938793 < / p>

我需要将URL从Server1更改为Server2,而不是每个都相同。还有一件事就是剩下的字符串不会是静态的,它会每次都改变。

1 个答案:

答案 0 :(得分:0)

您需要以下规则

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^server1
RewriteRule (.*) http://server2/$1 [R=301,L]

请点击此处了解详情:http://scriptplayground.com/tutorials/apache/Redirect-to-new-domain/