Move WordPress from a subdirectory to the root

The quickest way that I am aware of to move a WordPress installation from a subdirectory, e.g. From http://www.wpinstall.com/sub to http://www.wpinstall.com, is as follows:

1. Visit the WordPress admin area, click the “Settings” item on the menu, then select “General”.

switch-directory-start-markup

2. Remove the sub directory from the url path in the “WordPress Address (URL)” and “Site Address (URL)” fields.

 

switch-directory

3. Click the “Save Changes” button.

save-changes

 

Note: Your browser will likely hang and you may see an error page. This is because from the moment that you click the “Save Changes” button, your database is updated to reflect the new path (the root). And you are still trying to view your WordPress admin section from the sub directory which you just changed.

4. Remove the subdirectory from your url and refresh the browser.

url-sub-markup

5. This task should now be complete.

Note: There now may be images that no longer show. This is because the image path still contains the subdirectory. You will need to visit each post and change the image. If you have a large site with lots of photos, this could become a large task. In this case, you could run a database query to find and replace the subdirectory for all of your images.

By Kyle

My name is Kyle M. Brown and I am passionate about solving business problems with new technologies.

Leave a comment

Your email address will not be published. Required fields are marked *