简体   繁体   中英

Need an Apache Redirect Rule

I need to redirect urls in such a way as shown below.

http:// server1 /em/10_10_26_01_02?utm_content=Top-Join-Now-Link&utm_medium=Web-version&utm_campaign=Email-send2&utm_source=InfoUSA&CMPID=778374938793

to

http:// server2 /em/10_10_26_01_02?utm_content=Top-Join-Now-Link&utm_medium=Web-version&utm_campaign=Email-send2&utm_source=InfoUSA&CMPID=778374938793

I need to change the url from Server1 to Server2 other than that every thing is same. One more thing is like the remaining string wont be static and it will changes each and every time.

you need the following rule

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

See here for more details : http://scriptplayground.com/tutorials/apache/Redirect-to-new-domain/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM