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
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.
×
Hi Jack.
Yes, you are running Ubuntu.
There are a couple of ways to do what you want:
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:
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.
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.
Alrighty, have moved/deleted those files.
I don’t THINK I’ve got phpMyAdmin installed, I certainly don’t recall installing it and browsing to ’.com/phpmyadmin’ gives me a 404 Not Found so I think it’s safe to assume I don’t. Shall I follow this guide to get it installed?
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-14-04
Brilliant, thanks for that, I will give it a go and let you know what happens!
Unfortunately I’ve fallen at the first hurdle, somewhat!
Have followed the tutorial and installed apache2, the installation seemed to work correctly, it didn’t raise any errors or anything, but upon browsing to my public ip address all I get is a ‘403 Forbidden: You don’t have permission to access / on this server.’ message.
I followed on a bit further anyway and tried to install MySQL, but the tutorial mentioned that I should be asked to set a new password for the 'root user’, and this didn’t happen.
Sorry this is turning into more of a problem!
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, had a go at doing that, when it got to the point where I was setting new passwords, I got an error message;
‘ERROR 1045 (28000): Access denied for user 'root’@'localhost’ (using │
│ password: YES)’.
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:
DBUSER and DBPASSWORD should get you in
Okay, well I’ve had a look at that file. In my case the contents are;
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
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.
I think that probably is the case yeah, sorry, I thought I had finished setting up when I could see the wordpress dashboard!
@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
@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!