silverace
By:
silverace

How to change a website location and point domain to it's new path?

February 22, 2015 2.4k views

So 2 days ago I created a droplet with the automated wordpress builder digitalocean has. Looking at the future I might want to host multiple wordpress site on 1 droplet, and I'm trying to figure out how to go about this.

First, can I safely create a domain.com folder in var/www/ and move all the files there without breaking anything? Or are the databases configured in a way that make this impossible?

And second, after succeeding in step 1, with what putty commands would I redirect the domain to it's new path at var/www/domain.com?

Thanks in advance!

2 Answers

First, can I safely create a domain.com folder in var/www/ and move all the files there without breaking anything?

You can do that, but you will need to modify the site.conf file which is located in /etc/apache2/sites-available. It might be named 000-default.conf

On that file, there will be a section for DocumentRoot:

DocumentRoot /var/www/html

and possibly for the directory

<Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
    </Directory>

so change those sections from /var/www/html to whatever the new directory is you created. Restart and you should be good to go.

The database does not know, as Wordpress is looking for the database at localhost, regardless of what folder the website is installed in.

Have another answer? Share your knowledge.