Recently in Techie report Category

moving from WP to MT

RewriteRainbow.jpgHow do you redirect your old Word Press links to your new Movable Type links? And how do you talk about techy stuff on this nuze blog? Photoshop rainbow gradient ;) along with ftp or shell access to your site, knowledge of the .htaccess file, and commands like these:

My old WP links looked something like this:
http://blog.mysite.com/?m=200803

My new MT links look something like this:
http://mysite.com/MTblog/2008/03

I used the following two commands inserted into my .htaccess file:
RewriteCond %{QUERY_STRING} ^m=200803
RewriteRule ^(.*)$ http://www.mysite.com/MTdir/2008/03/? [R=301,L]

Since there was no similarly repetitive way to use regular expressions to refer to either set of links, I had to build one set of these commands for each link I wanted to preserve, replacing the m=200803 string with all the other strings for all the links I cared about and replacing the destination subdirectories /2008/03 accordingly.

One piece of advice I found on the web that was wrong derailed me for more hours than I'd like to admit. Do NOT put the RewriteEngine on / off lines around your rules to essentially comment out your code while you're debugging (or any other time). The Apache manual clearly states not to do this but I didn't catch it for quite a while.

In other words, don't do this:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^m=200803
RewriteRule ^(.*)$ http://www.mysite.com/MTdir/2008/03/? [R=301,L]
RewriteEngine off

RewriteEngine off
RewriteCond %{QUERY_STRING} ^m=200804
RewriteRule ^(.*)$ http://www.mysite.com/MTdir/2008/04/? [R=301,L]
RewriteEngine off
...

Instead, do this:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^m=200803
RewriteRule ^(.*)$ http://www.mysite.com/MTdir/2008/03/? [R=301,L]

If you're freshly installing a WP blog now, I'd suggest changing the default URL form. Seems there's no good reason to use this form. Maybe by the time you read this, they will have changed the default form to be more appropriate. If you've already accumulated links to your blog, you might not want to change this form unless you can redirect the existing links because all your links will change on your site and then the incoming links using the original form won't work.

Thanks to the help offered by so many via the web about web things, I've been able to do so much more of my own web work. And it finally happened - I wanted a solution for something that I couldn't easily find on the web. So now after much digging and trial and error, I happily offer my solution to keep this sharing thing going.

About this Archive

This page is an archive of recent entries in the Techie report category.

Talks is the previous category.

Uncategorized is the next category.

Find recent content on the main index or look in the archives to find all content.