Procedure For Changing The Directory Of A Wordpress Blog

For many sites the blog is only part of the site, not the main reason for the site existing. In these cases the blog is kept in the directory /blog or similar. Occasionally (for what ever reason) it might be necessary to change the directory. To that end here is a small walk through of the steps you need to take in order to do this.

  1. Find out what the new directory should be.
  2. Create a RewriteRule on the root directory of the site, but leave it commented. This is to redirect anything going to the old blog directory to the new blog directory using a 301. You can test that this works by swapping the words around so that when you type in the new directory name it should take you to the old directory name. The RewriteRule should look something like this:
    RewriteRule ^(.*)blog(.*)$ http://www.example.co.uk/new-blog/ [R=301,L]
  3. Alter the .htaccess file in the blog directory to have the details of the new directory rather than the old.
  4. Open the admin section of the blog and go into the main options page.
  5. Alter the Wordpress options to point to the new directory.
  6. Download the template files and do a global find/replace to swap any references to the old directory to the new one.
  7. Alter the live directory of the blog to be the chosen directory name.
  8. Quickly upload the changed files.
  9. Rebuild any files that are created by plugins, for example, this might be a sitemap.xml file.
  10. Test test test!

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
4 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.