Wordpress droplet. Adding additional virtualdomain

December 16, 2014 898 views

Hi there,
Sorry if this asked many times, I haven't found. I have some domain( for my wordpress installation. But Id like to add another domain ( Both domains would show/serve the same www/ directory.
I guess I have to edit vhost conf file. but it seems there are some other settings involved.
Can you provide with step by step guid?
Thank you

1 Answer


First, you will need to point the second domain to your droplet. To do that, add an A DNS record with the name of (with the trailing dot) and the value of your droplet's IP address.

Then, you need to configure Apache to serve the right content on that domain. If you want both domains to serve the same files, you can just set up the second domain as an alias to the first domain. Edit your Virtual Host config file in /etc/apache2/sites-enabled and add the following line after ServerName


If a ServerAlias line already exists, you have to append the second domain to it instead:


Finally, restart Apache so that the changes take effect:

sudo service apache2 restart
  • Everything @kamaln7 has posted is correct; however, Wordpress will not like that you are using a different domain than what is set as the Wordpress address (in general settings).

    To get around this, you can add something like this to your .htaccess:

    #redirect my2 to website root
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^my2\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

    That will redirect your second domain to the first domain.

Have another answer? Share your knowledge.