DNS add-on domain setup and redirect

Posted by brian on Pro Webmasters See other posts from Pro Webmasters or by brian
Published on 2011-05-14T23:16:33Z Indexed on 2011/11/12 2:13 UTC
Read the original article Hit count: 527

Filed under:
|
|

I have several domains which I'd like to point to another (I'll call it foo.com). A couple of things aren't entirely clear to me.

First, the DNS. I'm using Kloxo/HyperVM. Do I need to create separate DNS entries for each domain? Or do I just create separate CNAME or other records under foo.com? I thought it was the latter but when I click on "Add CNAME" I'm prompted to fill in the subdomain portion of foo.com.

The nameservers have already been set to point to my VPS.

For the redirect, would the following be appropriate within the vhost conf for foo.com?

ServerName www.foo.com
ServerAlias foo.com foo.net foo.org bar.com bar.net bar.org

RewriteCond %{HTTP_HOST} ^foo.com [NC]
RewriteCond %{HTTP_HOST} *foo.net [NC,OR]
RewriteCond %{HTTP_HOST} *foo.org [NC,OR]
RewriteCond %{HTTP_HOST} *bar.com [NC,OR]
RewriteCond %{HTTP_HOST} *bar.net [NC,OR]
RewriteCond %{HTTP_HOST} *bar.org [NC]
RewriteRule ^(.*)$ http://www.foo.com/$1 [R=301,NC]

(The first condition is just to force the "www" part)

© Pro Webmasters or respective owner

Related posts about redirects

Related posts about dns