schussman.com logo

Backend: Redirect Movabletype requests to Textpattern

I’ve put together a short and very, very ugly php script to match names of my Movabletype entries with their Textpattern counterparts (thanks again to Pix for his conversion script).

The script matches entry titles and then generates a list of redirect statements that can be put in a .htaccess file. Any subsequent request for your old Movabletype entries will be redirected to the appropriate Textpattern location. The script only works, however, with Movabletype archives of the form ”/archives/000001.html”; this script won’t do you any good if your entries are archived with names like ”/archives/Hey-This-Is-Fancy.html”. If there’s any interest, I’ll see what I can do to re-map those dirified URLs.

Does it work? Well, it seems to have worked for me. The script provides a workable solution to the problem of having search engines or other external sites point to your old Movabletype entries, and it redirects links from within your own entries (something similar to this functionality is on Pix’s to-do list; it’s nice to know that I don’t have Textpattern entries pointing to old-school MT entries).

Will it work for you? Geeze, I don’t have the slightest idea.

Note: Duplicates. The script highlights, but doesn’t attempt to correct, any duplicates that it identifies. These occur any time you have more than one match for any given title. In my case, I had lots of entries with the title “Quickies” or “Friday.” Obviously, you can’t have the same entry redirected to more than one address, so you’ll have to track down and get rid of the duplicates. Look for lines with “Dupe” appended to them, and note that the line immediately above that line is part of the duplicate set.

Don’t laugh at my code. I learned it from watching Dateline specials about computer hackers.

tpredir.php is here