views:

832

answers:

1

I recently moved from a asp.net host to a PHP host. I am trying to setup 301 redirects of my old urls using .htaccess. Here is what I want to accomplish:

old url: http://www.vasanth.in/downloads/download.aspx?file=file.zip
new url: http://www.vasanth.in/downloads/download.php?f=file.zip

I tried the following:

RedirectMatch 301 /downloads/download.aspx\?file=(.*)$ http://www.vasanth.in/downloads/download.php\?f=$1

This does not seem to work? What am I doing wrong?

A: 

Use mod_rewrite, something like this:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^file=(.+)$
RewriteRule ^(.+)\.aspx$ $1.php?f=%1
David Zaslavsky
Thanks. That fixed the problem.
Vasanth