I just upgraded my WordPress installation to 2.2.1 – partly because a friend warned me of a fairly dangerous exploit in the previous version. Since I’m hosted with Dreamhost, I use the “upgrade” option they offer in their admin panel, which is a quick and easy way to upgrade to the latest version of WP.

A few weeks ago I moved two of my posts to another blog using the .htaccess file method, but after upgrading to the new version of WordPress, the .htaccess file was apparently overwritten and the 301 redirects no longer worked. It’s a good thing I checked since the posts here were coming up here again, potentially causing duplicate content issues.

Since that’s the 2nd time I’ve had this happen, and since there were only 2 posts that needed to be moved, I decided to create a more fail-safe solution to this problem.

My permanent URL’s had been in this form:

blog.auinteractive.com/quick-introduction-to-hdr-photography/

so I created a directory with that same name and placed an index.php file within it using the following code:




So now if you go to

blog.auinteractive.com/quick-introduction-to-hdr-photography/

it will go to the directory and call

/quick-introduction-to-hdr-photography/index.php

and redirect that post to its rightful new home.

This way, when I upgrade my WordPress or make any changes to my .htaccess file, those directories will stay intact and make sure the posts are properly redirected. As an added precaution, I’d suggest deleting the old posts from the old domain once you see that Googlebot crawled it to prevent duplicate content issues in the future.

I guess another way to avoid this problem would be to backup your .htaccess file before upgrading your WordPress installation – especially if you have many rewrite rules.

P.S. Thanks to DaveN for the tip about using the WordPress code display plugin.