I have to redirect web addresses in a way as proven below.




I have to alter the url from Server1 to Server2 apart from that every factor is same. Yet another factor is much like the rest of the string will not be static and it'll changes every single time.

you'll need the next rule

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

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