Converting to web.config from ISAPI Rewrite 3
9 posts
• Page 1 of 1
Converting to web.config from ISAPI Rewrite 3
Hi
We've been running your excellent ISAPI rewrite for a few years now and our hosts have now decided to migrate to IIS7, I was wondering if you knew of the best way to convert the rules created by ISAPI re write into web.config compatible rules.
The re writes we are using use text files to get the correct I'd etc, the code is as follows
cheers
We've been running your excellent ISAPI rewrite for a few years now and our hosts have now decided to migrate to IIS7, I was wondering if you knew of the best way to convert the rules created by ISAPI re write into web.config compatible rules.
The re writes we are using use text files to get the correct I'd etc, the code is as follows
- Code: Select all
RewriteRule ^scaser\.asp$ range/%2/${showcaserange:%1}.asp? [NC,R=301,L]
RewriteRule ^range/(\d+)/([^?/]+)\.asp /scaser.asp?RID=${revshowcaserange:$2}&offset=$1 [NC,L]
RewriteCond %{QUERY_STRING} RID=(.*)$ [NC]
RewriteCond ${showcaserange:%1|NOT_FOUND} !NOT_FOUND
RewriteRule scaser\.asp$ range/${showcaserange:%1}.asp? [NC,R=301,L]
RewriteRule ^range/([^?/]+)\.asp /scaser.asp?RID=${revshowcaserange:$1}
RewriteMap showproducts txt:showcaseproducts.txt
RewriteMap revshowproducts txt:revshowcaseproducts.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} SPID=(.*)$ [NC]
RewriteCond ${showproducts:%1|NOT_FOUND} !NOT_FOUND
RewriteRule spod\.asp$ showcaseproduct/${showproducts:%1}.asp? [NC,R=301,L]
RewriteRule showcaseproduct/([^?/]+)\.asp /spod.asp?SPID=${revshowproducts:$1} [NC,L]
RewriteMap category txt:category.txt
RewriteMap revcategory txt:revcategory.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} CatID=(\d+)&offset=(\d+)$ [NC]
RewriteCond ${category:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^products\.asp$ categories/%2/${category:%1}.asp? [NC,R=301,L]
RewriteRule ^categories/(\d+)/([^?/]+)\.asp /products.asp?CatID=${revcategory:$2}&offset=$1 [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} CatID=(.*)$ [NC]
RewriteCond ${category:%1|NOT_FOUND} !NOT_FOUND
RewriteRule products\.asp$ categories/${category:%1}.asp? [NC,R=301,L]
RewriteRule ^categories/([^?/]+)\.asp /products.asp?CatID=${revcategory:$1} [NC,L]
RewriteMap brand txt:brand.txt
RewriteMap revbrand txt:revbrand.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} BrandID=(\d+)&offset=(\d+)$ [NC]
RewriteCond ${brand:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^products\.asp$ brands/%2/${brand:%1}.asp? [NC,R=301,L]
RewriteRule ^brands/(\d+)/([^?/]+)\.asp /products.asp?BrandID=${revbrand:$2}&offset=$1 [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} Brand=(.*)$ [NC]
RewriteCond ${brand:%1|NOT_FOUND} !NOT_FOUND
RewriteRule products\.asp$ brands/${brand:%1}.asp? [NC,R=301,L]
RewriteRule ^brands/([^?/]+)\.asp /products.asp?BrandID=${revbrand:$1} [NC,L]
RewriteMap room txt:room.txt
RewriteMap revroom txt:revroom.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} Room=(\d+)&offset=(\d+)$ [NC]
RewriteCond ${room:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^products\.asp$ rooms/%2/${room:%1}.asp? [NC,R=301,L]
RewriteRule ^rooms/(\d+)/([^?/]+)\.asp /products.asp?Room=${revroom:$2}&offset=$1 [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} room=(.*)$ [NC]
RewriteCond ${room:%1|NOT_FOUND} !NOT_FOUND
RewriteRule products\.asp$ rooms/${room:%1}.asp? [NC,R=301,L]
RewriteRule ^rooms/([^?/]+)\.asp /products.asp?Room=${revroom:$1} [NC,L]
RewriteMap size txt:size.txt
RewriteMap revsize txt:revsize.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} Size=(\d+)&offset=(\d+)$ [NC]
RewriteCond ${size:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^products\.asp$ sizes/%2/${size:%1}.asp? [NC,R=301,L]
RewriteRule ^sizes/(\d+)/([^?/]+)\.asp /products.asp?Size=${revsize:$2}&offset=$1 [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} Size=(.*)$ [NC]
RewriteCond ${size:%1|NOT_FOUND} !NOT_FOUND
RewriteRule products\.asp$ sizes/${size:%1}.asp? [NC,R=301,L]
RewriteRule ^sizes/([^?/]+)\.asp /products.asp?Size=${revsize:$1} [NC,L]
RewriteMap style txt:style.txt
RewriteMap revstyle txt:revstyle.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} style=(\d+)&offset=(\d+)$ [NC]
RewriteCond ${style:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^products\.asp$ styles/%2/${style:%1}.asp? [NC,R=301,L]
RewriteRule ^styles/(\d+)/([^?/]+)\.asp /products.asp?Style=${revstyle:$2}&offset=$1 [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} style=(.*)$ [NC]
RewriteCond ${style:%1|NOT_FOUND} !NOT_FOUND
RewriteRule products\.asp$ styles/${style:%1}.asp? [NC,R=301,L]
RewriteRule ^styles/([^?/]+)\.asp /products.asp?Style=${revstyle:$1} [NC,L]
RewriteMap colour txt:colour.txt
RewriteMap revcolour txt:revcolour.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} Colour=(\d+)&offset=(\d+)$ [NC]
RewriteCond ${colour:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^products\.asp$ colours/%2/${colour:%1}.asp? [NC,R=301,L]
RewriteRule ^colours/(\d+)/([^?/]+)\.asp /products.asp?Colour=${revcolour:$2}&offset=$1 [NC,L]
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} colour=(.*)$ [NC]
RewriteCond ${colour:%1|NOT_FOUND} !NOT_FOUND
RewriteRule products\.asp$ colours/${colour:%1}.asp? [NC,R=301,L]
RewriteRule ^colours/([^?/]+)\.asp /products.asp?Colour=${revcolour:$1} [NC,L]
RewriteMap products txt:products.txt
RewriteMap revproducts txt:revproducts.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NC]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule product\.asp$ product/${products:%1}.asp? [NC,R=301,L]
RewriteRule product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [NC,L]
cheers
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting to web.config from ISAPI Rewrite 3
Hello,
It seems that you'd like to migrate to microsoft default rewriting tools. There should be a microsoft .htaccess migration feature, and your rules look easy enough for it(I'm also more proficient in ISAPI_Rewrite syntax rather than Microsoft's and couldn't help much).
As a workaround we can suggest HeliconApe. It was designed specifically for IIS7+, it's free for up to 3 web-sites per server and it has the same syntax as ISAPI_Rewrite3.
Regards
Andrew
It seems that you'd like to migrate to microsoft default rewriting tools. There should be a microsoft .htaccess migration feature, and your rules look easy enough for it(I'm also more proficient in ISAPI_Rewrite syntax rather than Microsoft's and couldn't help much).
As a workaround we can suggest HeliconApe. It was designed specifically for IIS7+, it's free for up to 3 web-sites per server and it has the same syntax as ISAPI_Rewrite3.
Regards
Andrew
Re: Converting to web.config from ISAPI Rewrite 3
we've managed to get the hosting company to install APE but some of the redirects are causing loops...any suggestions?
the one in particular is
RewriteMap products txt:products.txt
RewriteMap revproducts txt:revproducts.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NC]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule product\.asp$ product/${products:%1}.asp? [NC,R=301,L]
RewriteRule product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [L]
cheers
the one in particular is
RewriteMap products txt:products.txt
RewriteMap revproducts txt:revproducts.txt
RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NC]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule product\.asp$ product/${products:%1}.asp? [NC,R=301,L]
RewriteRule product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [L]
cheers
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting to web.config from ISAPI Rewrite 3
Try to add NS-flag to all the rules like this. NS flag has slightly changed compared to ISAPI_Rewrite3
Re: Converting to web.config from ISAPI Rewrite 3
Thanks andrew that appears to have worked on evertything apart from the following
RewriteMap products txt:products.txt [NC, NS]
RewriteMap revproducts txt:revproducts.txt [NC, NS]
RewriteCond %{REQUEST_METHOD} !^POST$ [NS]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NS]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule product\.asp$ product/${products:%1}.asp? [NC,R=301,L,NS]
RewriteRule product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [NC,L,NS]
any suggestions?
RewriteMap products txt:products.txt [NC, NS]
RewriteMap revproducts txt:revproducts.txt [NC, NS]
RewriteCond %{REQUEST_METHOD} !^POST$ [NS]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NS]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule product\.asp$ product/${products:%1}.asp? [NC,R=301,L,NS]
RewriteRule product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [NC,L,NS]
any suggestions?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting to web.config from ISAPI Rewrite 3
Try the following modification:
RewriteCond %{REQUEST_METHOD} !^POST$ [NS]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NS]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^product\.asp$ product/${products:%1}.asp? [NC,R=301,L,NS]
RewriteRule ^product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [NC,L,NS]
All i did - add the '^' to show the beginning of the pattern.
Regards
Andrew
RewriteCond %{REQUEST_METHOD} !^POST$ [NS]
RewriteCond %{QUERY_STRING} PID=(.*)$ [NS]
RewriteCond ${products:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^product\.asp$ product/${products:%1}.asp? [NC,R=301,L,NS]
RewriteRule ^product/([^?/]+)\.asp /product.asp?PID=${revproducts:$1} [NC,L,NS]
All i did - add the '^' to show the beginning of the pattern.
Regards
Andrew
Re: Converting to web.config from ISAPI Rewrite 3
Thanks, that still seems to be giving the same, result, any other suggestions? the url bar seems to go to index.asp if that helps?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Converting to web.config from ISAPI Rewrite 3
We have no other choice but to start looking at the logs. PLease, create a rewrite.log with a testing request.
Logging issues are described here - http://www.helicontech.com/forum/forum_ ... -10648.htm
Regards
Andrew
Logging issues are described here - http://www.helicontech.com/forum/forum_ ... -10648.htm
Regards
Andrew
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 9 guests