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.
- Find out what the new directory should be.
- 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]
- Alter the .htaccess file in the blog directory to have the details of the new directory rather than the old.
- Open the admin section of the blog and go into the main options page.
- Alter the Wordpress options to point to the new directory.
- Download the template files and do a global find/replace to swap any references to the old directory to the new one.
- Alter the live directory of the blog to be the chosen directory name.
- Quickly upload the changed files.
- Rebuild any files that are created by plugins, for example, this might be a sitemap.xml file.
- Test test test!