Help for simple rewriting

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 25 Apr 2013, 08:35

Help for simple rewriting

25 Apr 2013, 08:41

Hi,

I would like to rewrite these URLs please:

FROM http://www.example.com/Details.cfm?ProdID=xxx
TO http://www.example.com/Details.cfm?product=xxx

FROM http://www.example.com/Details.cfm?ProdID=xxx&category=x
TO http://www.example.com/Details.cfm?product=xxx&category=x

FROM http://www.example.com/Details.cfm?ProdID=xxx&secondary=x
TO http://www.example.com/Details.cfm?product=xxx&secondary=x

FROM http://www.example.com/Details.cfm?ProdID=xxx&category=x&secondary=x
TO http://www.example.com/Details.cfm?product=xxx&category=x&secondary=x


Basically all the "ProdID"s need to be changed to "product"

x=variable numbers

Thanks
David

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help for simple rewriting

25 Apr 2013, 10:29

Hello,

Try using the following:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{QUERY_STRING} ^ProdID=(.*)$ [NC]
RewriteRule ^details\.cfm$ /Details.cfm?product=%1 [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 2
Joined: 25 Apr 2013, 08:35

Re: Help for simple rewriting

25 Apr 2013, 10:44

Hi Andrew

Thanks you very much for a quick reply. Is it also possible to do:

FROM http://www.example.com/Details.cfm?ProdID=xxx
TO http://www.example.com/Details.cfm?product=xxx

FROM http://www.example.com/Details.cfm?ProdID=xxx&category=x
TO http://www.example.com/Details.cfm?product=xxx

FROM http://www.example.com/Details.cfm?ProdID=xxx&secondary=x
TO http://www.example.com/Details.cfm?product=xxx

FROM http://www.example.com/Details.cfm?ProdID=xxx&category=x&secondary=x
TO http://www.example.com/Details.cfm?product=xxx

Basically renaming ProdID to product and get rid of category and secondary variables attached to the URLs and make a 301?

Kind regards
David

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Help for simple rewriting

25 Apr 2013, 16:15

It's possible:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{QUERY_STRING} ^ProdID=([^&]+)&.*$ [NC]
RewriteRule ^details\.cfm$ /Details.cfm?product=%1? [NC,R=301,L]


Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 18 guests