Rule works on Apache, not on IIS with ISAPI_Rewrite 3

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 27 Mar 2016, 12:22

Rule works on Apache, not on IIS with ISAPI_Rewrite 3

27 Mar 2016, 12:36

Hi,

The rule below works as expected on Apache 2.
It redirects a request that ends with "/shop/" to "/shop/Overview",
EXCEPT if the URL ends with "/sites/shop/".

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^(.*)/shop/?$ [NC]
RewriteCond %{REQUEST_URI} !^.*/sites/shop/?$ [NC] # Do not apply to sites/shop
RewriteRule . http://%{HTTP_HOST}%1/shop/Overview [R=301,L]

The URL we are testing with is this:
http://example.com/sites/shop/
It redirects to the URL below which is the wrong behaviour:
http://example.com/shop/overview

Why is it not working ?
We are using ISAPI_Rewrite 3.1.0.112.

- Thanks in advance

Best regards
Jimmy

User avatar
Posts: 2
Joined: 27 Mar 2016, 12:22

Re: Rule works on Apache, not on IIS with ISAPI_Rewrite 3

30 Mar 2016, 04:52

It turned out that ISAPI_Rewrite does not remove comments before interpreting the rules,
so the "# Do not apply to sites/shop" portion broke the expression.

Developers: Please consider changing this behaviour for maximum Apache compatibility.
Thanks.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 21 guests