Mapping WordPress URLs to Typo
Jul 18th, 2006 by phil
I recently moved my fiatdev.com from WordPress to Typo. As part of the move, I wanted to make sure that all of the WordPress URLs continued to work. I started out trying to do this with mod_rewrite, but had some problems making it work the way I wanted. In the end, I used mod_alias RedirectMatch rules which did exactly what I wanted in a slightly less cryptic way.
RedirectMatch permanent ^/wp/?$ http://fiatdev.com/
RedirectMatch permanent ^/wp/feed/?$ /feed
RedirectMatch permanent ^/wp/(200./.*)/$ /articles/$1
RedirectMatch permanent ^/wp/categories/(.*)/$ /articles/tag/$1
RedirectMatch permanent ^/wp/(.*)/$ /pages/$1
The WordPress installation was rooted at the URL ‘/wp/’. The first rule handles the case when the user types in http://fiatdev.com/wp/, which is the old URL. The next rule handles the RSS feed, which is currently managed by FeedBurner. The next three rules handle articles, categories and pages. It is worth noting that the rule that handles articles also makes the date based archives work.
Finally, I borrowed a RewriteRule from my old WordPress installation to redirect anything that looks like a request for an RSS feed to FeedBurner:
RewriteCond %{QUERY_STRING} ^feed=(feed|rdf|rss|rss2|atom)$
RewriteRule ^(.*)$ http://feeds.feedburner.com/fiatdev [R,L]
RewriteRule ^(feed|rdf|rss|rss2|atom)/?(feed|rdf|rss|rss2|atom)?/?$ \
http://feeds.feedburner.com/fiatdev [R,L]




