After moving the blog to  WordPress, almost all my redirects should work now from the old blog posts to the new one. For example if you click on this old url http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx it should redirect you and you see the new and correct url.

Overall it was simple to setup via the .htaccess file and some simple regex. The only thing I found the hard way was that I should be using “RedirectMatch” when setting up the regex rule rather than the “Redirect” which is what I was using. You would use Redirect when trying to redirect without any variables.

So, as in my case I wanted to redirect from the old url (of community server) to the new one (of wordpress)

So I need to make the following changes:

  • Change the “/weblog” to “/blog”
  • Get rid of “/archive”
  • Get rid of the “.aspx” extension

The following rule helped me achieve this:

RedirectMatch 301 /weblog/amit/archive/(\[0-9\]\[0-9\]\[0-9\]\[0-9\])/(\[0-9\]\[0-9\])/(\[0-9\]\[0-9\])/(.\*)\\.aspx$ http://desigeek.com/blog/amit/$1/$2/$3/$4

Of course there are a few more rules I have which I cannot go into details.

Along the way i also discovered a few interesting tools which can help you view the results – one is LiveHTTPHeaders ; another good one is http://web-sniffer.net/ .

If you are new to this, then a few very good tools online. I would suggest start with this post from Zo and this tutorial on regex .

i still have one outstanding issue where if I want to redirect part of the URL and not the complete thing, I am not sure how to do it. For example if I want to redirect the old url above to just the year/month of the post instead if the actual post, not sure how to go about doing it. So I want the url below to map to the the one below that.