Question

Moving my wordpress install to a sub-folder

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

Subscribe
Share

Sorry, I assumed you had a working install of WordPress already. it looks like you installed WordPress, but have not set it up yet, nor have you set up Apache yet.

Is that the case?

If so, then you do indeed need to set up Apache and MySQL. Not a big deal.

If you wanted to make life a tad easier, you could also destroy your droplet and and create a new one:

choose Ubuntu 14.04 as the OS under applications choose WordPress and PhpMyAdmin

If you would rather stick with what you have, that will also work fine. You just need to get Apache and MySQL working first, then do WordPress and PhpMyAdmin after.

Your MySQL username and password are the same for what you use to connect Wordpress to the database.

You can find this by going into your folder ~/www/blog/wp-config.php

open that file with any text editor, and you will find a section with this:


// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'yourwpdatabase');

/** MySQL database username */
define('DB_USER', 'yourusername');

/** MySQL database password */
define('DB_PASSWORD', 'yourpassword');

/** MySQL hostname */
define('DB_HOST', 'localhost');

DB_USER and DB_PASSWORD should get you in

Sorry you are having those issues; however, if Wordpress was running already on your site, then Apache2, php, and MySQL are already installed.

All you should have to do is install phpmyadmin:

sudo apt-get install phpmyadmin

then restart apache with:

sudo service apache2 restart

Hang in there, you are getting it! It just takes a bit of dinkering with things.

Okay, great. So that index.php and xmlrpc.php will need to be moved to blog as well. The license.txt and readme you can just delete.

Next thing you will need to do is tell Wordpress that it is located in a subfolder. Do you have phpMyAdmin installed?

If so, you can just log into yourdomain.com/phpmyadmin and find the database, scroll down to the table named wp-options and find the option named “site url”

it should have your domain as the option value, you can kind of double-click it real fast and it will let you edit it, or you can just click the little pencil icon to edit . Change your domain to http://yourdomain.com/blog

save, and now you should be able to access your Wordpress site at yourdomain.com/blog

and now you can build your home-page or whatever in your www folder.

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?

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?

@wittersmaxime can you start a new thread and describe what has happened (did you create a new droplet with Wordpress, was it just a LAMP droplet? was wordpress working previously and now it is not?)

use @sierracircle in your new thread so I can be notified.

Be as descriptive as possible. Thanks!

@sierracircle hi, sorry to chip in on this topic but the only thing I have in var/www is wp-config.php . Something went wrong I guess, any idea how to fix this? Kind regards

I think that probably is the case yeah, sorry, I thought I had finished setting up when I could see the wordpress dashboard!

Okay, well I’ve had a look at that file. In my case the contents are;

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */

/** MySQL database username */

/** MySQL database password */

/** MySQL hostname */
define('DB_HOST', 'localhost');

If I try and run sudo apt-get install phpmyadmin again I get ‘phpmyadmin is already the newest version’ but if I browse to mywebsite.co.uk/phpmyadmin I still get a 404 Not Found message.

Sorry, this really is turning into a real hassle! :P


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

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.

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

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

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

This comment has been deleted