Solved! Moving WordPress to root folder to make it multi-site compatible

Andrew's picture

I need to use WordPress in multi-site mode and, from reading the WP documentation, I see that it won't work in a sub-folder so I've moved it from the /var/www/wordpress folder to /var/www.

Since this wasn't straightforward, I thought I'd outline the steps (which I discovered  through a lot of searching and trial and error):

1) Delete the index.html file in /var/www.

2) Move the files from the /wordpress folder into /var/www.

3) Edit the Apache virtual hosts for ports 80 and 443  to point to /var/www.

4) Edit the directives in the WordPress config file to point to /var/www.

5) In the wp-options table in the wordpress database, change the siteurl and home fields to your site's IP address. Not sure if this is strictly necessary (or even advisable) but I did it and everything seems to be OK.

6) Log onto the web shell and enter the following command: chown -R www-data: /var/www

This last step changes the ownership of the root directory so that WordPress can write to it.

I hope that helps anyone struggling with this.

PS When you convert to multi-site, you will be asked to create a blogs.dir folder and, possibly, an .htaccess file. Make sure you set the ownership of thess to www-data (just like all the other files and folders in /var/www) so that wordpress can access them.

Jeremy Davis's picture

Thanks for that, hopefully it will help someone else (I'm sure it will). I read your initial post but had nothing useful for you. Only thing I'd suggest is that IMO step 6 would ideally be:

chown -R www-data:www-data /var/www

As it then will be owned by www-data user and www-data group. Obviously your way still works, but I think it is better to explicitly set the group as well.

For clarity (others reading this and finding it useful): You can just run that same command again after creating blogs.dir folder and .htaccess (or any other) file(s). The -R switch makes the chown command recursive ie the folder and all of it's contents.

Hi Andrew, thanks for the info.

I am new at this and am hoping you can please expand a little on the 4th step.

[ 4) Edit the directives in the WordPress config file to point to /var/www. ]

Opened the file up but haven't a clue what to enter.

Any assistance gratefully accepted.






Just to let you know.

I seemed to have got it working.

But for step 4 i needed to  define '/' and not '/var/www' in the wp-configfile, for it to work.

Hope thats ok

Andrew's picture

It's nice to know my experience is helping others, so thanks for letting me know Owen.

I've actually decided to build my own server using Nginx, and it's loads faster than Apache.



Jeremy Davis's picture

FYI from what the devs have said previously Apache was chosen as the default for TKL appliances because of the (relavative) ease of config as well as the huge amount of documentation available (and generally easier to get help with). Also the fact that there is no Webmin module for NginX makes the bar a little higher too.

Bruce Benson ('s picture

To get the sub-domain install option to show, the siteurl must not have a "/" ( or be "localhost" or be an IP address.

I spent too many hours trying to get the subdomain option to show and it was because I was testing things out using a copy of my site running with just a bare ip address (192.168.x.x).   So I just entered a hosts file entry (e.g., mydomain) and browsed to mydomain and then "sub-domain install" appeared on the network menu.

Bruce Benson ('s picture

And this is clearly documented in Create_A_Network, including the solution I mentioned.  Sorry.

Post new comment