Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: phranque

Message Too Old, No Replies

Redirect with parameter

Redirecting http://mysite.com/buy.asp?123 to http://mysite.com/buy.php?123

     
6:58 am on Apr 2, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 9, 2002
posts:47
votes: 0


I have recently moved my hosting from Windows to a Linux server. The previous affiliate tracking system was written in ASP which now been converted to php. But many of my affiliates still have the old links on their websites.
I can redirect the the .asp links to the new .php pages with .htaccess. But I don't know how to pass the parameters with the redirect.

[mysite.com...] --> [mysite.com...]

Any ideas?

2:31 pm on Apr 2, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


saurabh,

Something like this will work. The "%1" in the RewriteRule back-references the value that matches inside the parentheses in the RewriteCond, so the variable "123" in your example is passed on to the new URL.


RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^buy\.asp$ /buy.php?%1 [R=301,L]

Good reference: Introduction to mod_rewrite [webmasterworld.com]

HTH,
Jim

6:19 pm on Apr 4, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 9, 2002
posts:47
votes: 0


Hi Jim,
Thanks for the tip, I'll try it out and let you know.

Regards
Saurabh

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members