Use mod_rewrite or RedirectMatch to redirect oldfile.aspx?p=blah to newfile.php, ignoring ?p=blah
Posted
by
Dan
on Server Fault
See other posts from Server Fault
or by Dan
Published on 2011-02-17T14:45:32Z
Indexed on
2011/02/17
15:27 UTC
Read the original article
Hit count: 314
301-redirect
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?
© Server Fault or respective owner