Forum Moderators: phranque
So from www.oldsite.com to www.newsite.com
from sub1.oldsite.com to sub1.newsite.com
from sub2.oldsite.com to sub2.newsite.com
etc.
Is there a way to do this in a couple of lines?
I have tried variations on:
<VirtualHost 192.168.0.50:80>
ServerName www.oldsite.com
ServerAlias *.oldsite.com
RedirectPermanent / [newsite.com...]
</VirtualHost>
but no luck.
Any help would be greatly appreciated.
In httpd.conf or conf.d:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+\.)?old_site\.com [NC]
RewriteRule ^/(.*)$ http://%1new_site.com/$1 [R=301,L]
Jim