Question

Multiple Domains for one website

  • Posted August 30, 2014

Hi,

I want to have 1 drupal site with 2 domains i.e. .com .com.au.

I have setup my dns for the .com just the basic dns setup and pointed the domains at the DO nameservers. The .com is now resolving but the .com.au which I have also created dns for does not resolve.

I have tried to add vhosts file to the apache server but this has not worked.

PLease any help or suggestions would be greatly appreciated.

Regards

Oliver

Subscribe
Share

I am still figuring out the best approach for this kind of thing, but I have managed it two different ways:

  1. use the 000-default.conf file for the first domain (rather than creating a separate conf file) …this makes that domain the default website, and unconfigured domains will point to that site

  2. A different approach I have done is to set up a conf file for the second domain, and then in that directory for the second domain I put an .htaccess file that redirects to the first site. The .htaccess file has this in it:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^firstdomain.com.au$ [OR]
  RewriteCond %{HTTP_HOST} ^www.firstdomain.com.au$
  RewriteRule (.*)$ https://firstdomain.com/$1 [R=301,L]
</IfModule>

Of course, if your .au.com is not resolving at all, it might just need a little more time if you have only recently made DNS changes.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

without ssh is working. I will work to get the second start ssl certificate and to try also with it.

my idea is to have 2 very similar .conf files for both domains and only the certificates to point to their specific location. In my case it is about startssl certificates. I will give it a try…

I would like to extend this question with another detail: how will this work in case the 2 domains are secured with (different) ssl certificates?

thank you.

Since you mentioned this in the LAMP category the easiest way to do this is to point the domains to the same IP address.

Then inside of your VirtualHost just add the following:

ServerName domain.com
ServerAlias www.domain.com domain.au.com www.domain.au.com

And you’re all set!