Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect of dymanic aspx page to php page

         

jacuzzi

7:53 am on Mar 17, 2010 (gmt 0)

10+ Year Member



I'm really struggling with this one. I am migrating an ASP.NET site to PHP and I need to do some redirects of dynamic .aspx pages which are in the format /page.aspx?id=5 and then 301 redirect these to /page/description/

There isnt a pattern to the redirection so I just want to provide a list of old pages mapping to new ones and not use regex etc.

I have tried
application/x-httpd-php .aspx
redirect 301 "/oldpage.aspx?id=12" [site.com...]

Also tried

RewriteEngine On
RewriteCond [site.com...]
RewriteRule [site.com...] [R=301,L]

But neither work....

Any help much appreciated!

g1smd

8:09 am on Mar 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need to study the Apache documentation and previous examples a bit more, as many key elements are missing from your example. This code cannot be guessed.

There's several ways to tackle this. One is to have a long list of redirects in your .htaccess file.

The other is to rewrite those requests to a special redirection script, that script look up the final URL and that script send the 301 redirect header and destination URL.

For efficiency, I'd choose the latter method.