Question

Wordpress droplet. Adding additional virtualdomain

  • Posted on December 16, 2014
  • sasharedsAsked by Alex R

Hi there, Sorry if this asked many times, I haven’t found. I have some domain(my.fancydomain.com) for my wordpress installation. But Id like to add another domain (my2.fancydomain.com). 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


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi!

First, you will need to point the second domain to your droplet. To do that, add an A DNS record with the name of my2.fancydomain.com. (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 my.fancydomain.com:

ServerAlias my2.fancydomain.com

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

ServerAlias some-other-domain.com my2.fancydomain.com

Finally, restart Apache so that the changes take effect:

sudo service apache2 restart