Mobile app version of vmapp.org
Login or Join
Shelley277

: DNS add-on domain setup and redirect 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

@Shelley277

Posted in: #301Redirect #Dns #Redirects

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 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 ^(.*)$ www.foo.com/ [R=301,NC]


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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Shelley277

2 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

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

10% popularity Vote Up Vote Down


 

@Alves908

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme