Remapping old page and query params to new

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 8
Joined: 07 Aug 2012, 04:26

Remapping old page and query params to new

07 Aug 2012, 04:32

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]

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Remapping old page and query params to new

07 Aug 2012, 04:55

Please try it like this:

RewriteCond %{QUERY_STRING} ^name=([^&]+)$ [NC]
RewriteRule ^oldpage\.asp$ /newpage.asp?n=%1 [NC,L]

User avatar
Posts: 8
Joined: 07 Aug 2012, 04:26

Re: Remapping old page and query params to new

07 Aug 2012, 05:17

That works like a charm
Many, many thanks for the quick reply.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 13 guests