Great Howto for 301 Redirects for Dynamic URL’s

I have recently moved a site over from an ASP content management system to Joomla.

One of the tricky things was creating the redirects for the pages on the old site to the new.

Normally this is easy enough when you are redirecting a static page to another static page. Unfortuntely the mod_rewrite in Apache that is responsible for doing the rewriting of the URL’s cannot manage parameters after file name in the standard way, ie:

I wanted to send oldsite.com/index.asp?id=1 to newsite.com/news

However, everytime I used the standard redirect:

redirect 301 /index.asp?id=1 http://www.newsite.com/news

I ended up with a URL like : http://www.newsite.com/news?id=1

So I found a great resource here >> http://bit.ly/5WLc8q

It broke down the workings of the redirect and included the followign example

RewriteCond %{QUERY_STRING} ^id=1$
RewriteRule ^page.php$ http://www.example.com/content/page? [R=301,L]

Once I used my own page references it worked great.

A big thanks to Alex Juel ( http://twitter.com/seoholicc ) for this tip!