I have setup a domain, I and I would like to point that domain onto a different webserver.
lets say:
domain 1: www.test.com on server 1
domain 2: www.test1.com on server 2
I would like to forward www.test1.com to www.test.com, and I have tried to do that with setting up a virtual host on server 2 and mod_rewrite.
The virtual host looks like this:
<virtualhost XXX.XXX.XXX.XXX:80>
ServerName www.test1.com
ServerAlias test1.com *.test1.com
RewriteEngine On
RewriteCond %{HTTP_HOST} (.*)\test\.com
RewriteRule ^(.*) http://%1test.com/$1 [R=301,L]
</VirtualHost>
Everything works fine except that http://test1.com does not redirect.
Question 1: How would I go about redirecting all requests (subdomains everything) that come into http://test1.com to http://www.test.com using mod_rewrite.
Question 2: do I need to specify a directory in this case for the virtual host?
Question 3: do I need the ServerAlias or is it counter productive here?
UPDATE:
Ended up with doing a 301 with following setup
<virtualhost <ip>:80>
ServerName test1.com
ServerAlias www.test1.com
Redirect 301 / http://www.test.com
</VirtualHost>