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)

2 Answers 2


If you are redirecting a few domain to one, why not do this in your registrars account and forward the domains to your one primary domain? Doing it in .htaccess or even in DNS is a bit of a waste of resources when you can configure it in the registrar account to forward.

You can also set your www in the DNS management with @ instead of using a 301


I'd use DNS A record and point them to same IP and then using VirtualHost in Apache set them up to be catchall, this way you can have all domains going into one and then if you need to use mod_rewrite you can manipulate with that in whatever way you wish

  • Thanks, Alexus. I did that, and also included the rewrite rules. All is working correctly. However, when creating the DNS zone files for the other domains, I get a bunch of records that I'm not sure are necessary. These are CNAMEs lists, webmail, and ftp; an MX; and a mail A record. SHould I delete those and just keep the www CNAME and the ns* A records?
    – user7519
    May 15, 2011 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.