Phew, redirects are good!

So I think I’ve got all the old articles appearing at their old urls using .htaccess Redirect rules. This is a modification of a method described in the WordPress MT-Redirect method.

I had a directory of the old numerically-named MT archives, so I used the following script to create a .htaccess file:

for f in 000*html
do
 v=`basename $f .html`
 g=`echo $v | sed 's/^00*//;'`
 echo 'Redirect Permanent' /blog/archives/$f 'http://scruss.com/blog/index.php?p='$g
done

which looks like:

Redirect Permanent /blog/archives/000001.html http://scruss.com/blog/index.php?p=1
Redirect Permanent /blog/archives/000002.html http://scruss.com/blog/index.php?p=2
Redirect Permanent /blog/archives/000003.html http://scruss.com/blog/index.php?p=3
 ...
Redirect Permanent /blog/archives/000322.html http://scruss.com/blog/index.php?p=322

I put this .htaccess file in the root (top level) directory of my domain, and it all works! Everything I set out to do when reindexing my old MT entries has been completed — see, lookit: http://scruss.com/blog/archives/000214.html

Leave a comment

Your email address will not be published.