Moving my wordpress install to a sub-folder

March 19, 2015 12.4k views
WordPress Ubuntu

Hello,

I'm currently fiddling around with a droplet I created a few weeks ago. I followed the steps to put a default wordpress install on the droplet. However, Ideally I'd like to use the wordpress install for just my blog, and build my own home page.

I have had a little nose around for how to do this, and it seems to be that if I have my wordpress install in a subfolder (the 'index.php' file specifically?) then I can just point people at that from my homepage.

So I connected to my droplet using WinSCP and had a look, in 'root' all I have is what I suppose is a file, called 'WORDPRESS'. I have worked with wordpress before, through GoDaddy, and when using their file explorer it appeared that a wordpress install was actually a series of folders, so that got me wondering whether I even had worpress installed correctly?

In short, does it sound like I have wordpress installed correctly? And how would I go about using wordpress just for a blog page on my site?

(Also, I put distribution as 'Ubuntu', but to be honest I wasn't even sure what 'distribution' meant! Ubuntu is just what I appear to be running when I log in to the droplet using PuTTY: 'Welcome to Ubuntu 14.04.1 LTS ')

Thanks,

Jack

16 comments
  • Hi Jack.
    Yes, you are running Ubuntu.

    There are a couple of ways to do what you want:

    1. you can put your entire Wordpress site into a sub-folder and then build your main site in the top-level folder.
    2. you can work within your existing Wordpress and modify the files in your theme folder. This is more simple than it might sound. For example, if you create a file called front-page.php in your theme folder, that page will show up as your home-page.

    Either way will work. Each way has a few things you need to do first.

    Your Wordpress install is only in one folder at the moment: your web-root folder. This is usually in /var/www/

    Do you have access to command-line?

  • Hi,

    I do have access to the command line, yeah.

    Also, for reference, I'd prefer to have the wordpress install in a sub folder, as I've not got much experience with php!

    Also also, apologies for the double comment, I deleted my first comment and attempted to use the 'reply' link on your comment, but that didn't seem to do anything at all...

    Thanks for the quick response!

  • Okay, first thing: let's establish you can access your web-folder. Run these commands one by one:

    sudo usermod -aG www-data $USER
    sudo chown -R www-data:www-data /var/www
    sudo chmod -R 774 /var/www
    sudo ln -s /var/www  ~/
    

    once you run those commands, you should be able to log in via sFTP and see a folder called www. Inside that folder should be all of your web folders and web files.

    It should be a bunch of files with wp- in front of each them. You can create a sub-folder and move all of those files and folders into your sub-folder.

    So now you should have ~/www/subfolder with all of your wordpress stuff in it.

    Does that work..things going okay so far?

  • Yep that all seems to have worked! I've moved all the files with the wp- prefix into a subfolder 'blog'.

    So now in ~/var/www I have;

    A folder called 'blog' and files called 'index.php', 'license.txt', 'readme.html' and xmlrpc.php'.

    And 'blog' contains all the other files that were present.

  • Show 12 more comments
4 Answers

yes, that will probably be easiest, and most likely you will find yourself using phpMyadmin for many other things.

Hmm.. if you can see the Wordpress dashboard, then you should have all that installed. I wonder what is going on.

Are you able to browse to http://yoursite.com/blog/wp-admin

Okay, well, it really sounds like MySQL is installed, but I am not sure why your MySQL username and password are not on your wp-config file.

How about this:

move (just temporarily) all of your files from www/blog back to www

once you have that done..log in to your wordpress dashboard.

Go to http://badlymauledboy.co.uk/wp-admin/options-general.php and change your Wordpress Address and Site Address both to http://badlymauledboy.co.uk/blog

click save

move all your files back into blog and then try to log in to http://badlymauledboy.co.uk/blog/wp-admin

[deleted]
Have another answer? Share your knowledge.