: 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
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)
More posts by @Shelley277
2 Comments
Sorted by latest first Latest Oldest Best
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.