Use mod_rewrite or RedirectMatch to redirect oldfile.aspx?p=blah to newfile.php, ignoring ?p=blah
- by Dan
I've got a site with many incoming links to the old structure (gone for years), with tonnes of URL vars that are no longer relevant, as the database mappings were changed. So, I'd like to redirect:
http://www.mysite.com/oldfile.aspx?p=1&c=2
to:
http://www.mysite.com/newfile.php
without the query string at the end. The actual query string varies - there are hundreds of them, but since they don't match up to a particular case anymore, I want to take people to the new index page for the content they're looking for, so they can find it from there.
I currently use:
RedirectMatch 301 ^/oldfile\.aspx$ /newfile.php
This puts the query back on the end though. Can someone let me know the voodoo recipe I need?