Redirect loop with Ape, worked fine with ISAPI_Rewrite
3 posts
• Page 1 of 1
Redirect loop with Ape, worked fine with ISAPI_Rewrite
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.
But when using Ape, this same .htaccess file causes a redirect loop. Any idea why, and how can I work around it?
- 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?
Re: Redirect loop with Ape, worked fine with ISAPI_Rewrite
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.
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.
Re: Redirect loop with Ape, worked fine with ISAPI_Rewrite
Thanks Anton, adding the NS flag fixed my issue. That makes sense given what I have read about how Ape handles requests.
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 24 guests