How to Rename an Apache Website Virtual Host on Ubuntu

I recently setup a Linode Linux server and am getting used to managing my sites without the help of cPanel. Depending on the circumstances, I sometimes setup a fake domain name on the new server and point the host file on my development computer to the fake domain name. This lets me run the live website and the development website side-by-side. This makes porting over existing content easier. Once the new website is ready to go live, I’ll rename the domain on the server to it’s actual value, remove the host file entries on my computer, then update public DNS.

Here’s how the renaming part is done on Ubuntu.

Disclaimer: I’m new to this! This worked great for me, but if there’s a better way, please let me know in the comments.

Renaming an Apache virtual host on Ubuntu 14.04

Example: we will be renaming to

  1. Rename the directory holding the site
  2. Rename the virtual host conf file
  3. Open the file and update the domain name from to
  4. Enable the “new” site
  5. Remove the “old” site symlink
  6. Restart the Apache service


3 thoughts on “How to Rename an Apache Website Virtual Host on Ubuntu

  1. You also have to a2disconf oldsite and rename the file under conf-avaliable and then a2enconf newsite and reload service.

Comments are closed.