Remapping old page and query params to new
3 posts
• Page 1 of 1
Remapping old page and query params to new
I'm sure this is simple but I can't find the answer.
How do I convert an old url parameter to a new one where the page script is different (page.asp becomes newpage.asp) and also the querystring parameter is different (?name= becomes ?n=)
e.g.
change this:
http://www.mysite.com/oldpage.asp?name=pagename
to this:
http://www.mysite.com/newpage.asp?n=pagename
I tried variations for this:
RewriteRule ^oldpage\.asp$ /newpage.asp?n=$1 [NC,L]
How do I convert an old url parameter to a new one where the page script is different (page.asp becomes newpage.asp) and also the querystring parameter is different (?name= becomes ?n=)
e.g.
change this:
http://www.mysite.com/oldpage.asp?name=pagename
to this:
http://www.mysite.com/newpage.asp?n=pagename
I tried variations for this:
RewriteRule ^oldpage\.asp$ /newpage.asp?n=$1 [NC,L]
Re: Remapping old page and query params to new
Please try it like this:
RewriteCond %{QUERY_STRING} ^name=([^&]+)$ [NC]
RewriteRule ^oldpage\.asp$ /newpage.asp?n=%1 [NC,L]
RewriteCond %{QUERY_STRING} ^name=([^&]+)$ [NC]
RewriteRule ^oldpage\.asp$ /newpage.asp?n=%1 [NC,L]
Re: Remapping old page and query params to new
That works like a charm
Many, many thanks for the quick reply.
Many, many thanks for the quick reply.
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 13 guests