Wordpress from Sub directory to Root folder
If you work on a test site for your new wordpress website there comes a point when you need to make the site live and move from the test folder and into the root. There are a few steps to follow but it’s straightforward and the only time consuimng part is waiting for the many wordpress files to upload.
1. Firstly take a backup of your test site folder. If something happens at least you can restore everythign back to the original state and try again.
2. Copy all the files of /blog folder into the main root of your site. Make sure you copy the .htaccess file too. Make sure you remove and index.html folders or index.php and any image folders that do not need to be there.
3. Open your wp-config.php file of the files you just moved over to the root folder and the line below, it needs to be added towards the base of the page and will be the last define statement:
define(‘RELOCATE’,true);
when you have done that save the file and upload to the root
4. Now open your browser and open the page http://www.yourdomain.com/wp-login.php and enter your admin login details.
5. In your admin area go to the General Settings and make sure in WordPress address (URL) field, you have http://www.yourdomain.com and remove the url placed in the Blog address field. Make sure there is no trailing “/” in either of the fields.
6. Check your .htaccess file in the root directory and make the content like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Once this has been done you are now ready to test, you may notice that some images placed in your pages have been broken, all you need to do is click on each and point them to your new folder, you will be able to do this within the media library. Or alternatively you can leave your wp-content folder/uploads intact within your subfolder and remove all other files.
Any new images you place in your site will be uploaded to the root upload folder.
7. Finally again open wp-config.php and remove
define(‘RELOCATE’,true);
save the file and upload.
all done!

