Parvinder Bhasin wrote:
Hi,

I am stuck at this situation:

Where I have a domain:  abc.com :

I would like to have user who type http://abc.com (without the www) redirected to a a different site for example : www.xyz.com
Redirection for www.abc.com to www.xyz.com works fine.

From memory, the easiest way would be:

If you use the stock httpd and you control your web server, the easiest way would be in your httpd.conf with the "LoadModule rewrite_module" enable in your httpd.conf.

assuming your DNS A records for both the abc.com and www.abc.com goes to 1.2.3.4 as example.

Something like that would work:

<VirtualHost 1.2.3.4>
        ServerName abc.com
        RewriteEngine on
        RewriteRule ^/(.*)              http://site1.xyz.com/$1
</VirtualHost>


<VirtualHost 1.2.3.4>
        ServerName www.abc.com
        RewriteEngine on
        RewriteRule ^/(.*)              http://site2.xyz.com/$1
</VirtualHost>

and then you can have both your URL go else where assuming you are OK with the URL to be changed as well in the users browsers as it will do that.

DNS resolved name, not redirection in the content really.

Hope this help you.

Best,

Daniel

Reply via email to