homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

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)

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)


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]



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

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


Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved