Redirect loop with Ape, worked fine with ISAPI_Rewrite

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 2
Joined: 10 Apr 2015, 10:52

Redirect loop with Ape, worked fine with ISAPI_Rewrite

10 Apr 2015, 10:58

I'm using ISAPI_Rewrite to remove .asp extensions from the URL (example.com/login.asp --> example.com/login). Also when someone does use an .asp extension, I do a 301 redirect to the extension-less URL. This works fine for ISAPI_Rewrite.

Code: Select all
     #Redirect extension requests
     RewriteRule ^([^?]+)\.asp$ $1 [NC,R=301,L]

     #Internally add extensions to request
     RewriteCond %{REQUEST_FILENAME}.asp -f
     RewriteRule (.*) $1.asp [L]


But when using Ape, this same .htaccess file causes a redirect loop. Any idea why, and how can I work around it?

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

Re: Redirect loop with Ape, worked fine with ISAPI_Rewrite

13 Apr 2015, 15:03

Hello,

Redirects are realized somewhat differently in Ape, so please fix your rules like this:

#Redirect extension requests
RewriteRule ^([^?]+)\.asp$ $1 [NC,R=301,L,NS]

#Internally add extensions to request
RewriteCond %{REQUEST_FILENAME}.asp -f
RewriteRule (.*) $1.asp [L]

Generally, NS flag is needed in the redirect rule.

User avatar
Posts: 2
Joined: 10 Apr 2015, 10:52

Re: Redirect loop with Ape, worked fine with ISAPI_Rewrite

14 Apr 2015, 15:04

Thanks Anton, adding the NS flag fixed my issue. That makes sense given what I have read about how Ape handles requests.

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 35 guests