WordPress mod_rewrite still allows old URL string

If you migrated a WordPress blog from the old style URLs using the built-in permalink options, you may be surprised that all the old URLs are still accessible. This causes a problem with search engines which have already indexed those old URLs as they will look at the new URLs as duplicate content.

`/blog/?p=123`

The “quick fix” for this is a few lines of code added to the top of the “single.php” file in your wordpress template:

`

`

I will be writing up a plugin to add this functionality in a more WordPress friendly way, but for now a quick code change will work. :)