This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: SSL Redirect Infinite Loop
Author
Message |
jpearce98
Newbie


Joined: 11 January 2012
Posts: 1
Posted: 12 January 2012 at 11:25am

Hi everyone. This is my first time posting after trolling the forums for weeks now trying to understand how
ISAPI_Rewrite works.

Here is what I am trying to do and need help. My site has one file that needs to be over SSL. So I am trying to
force all links to this file to be over SSL and after a user goes to this page and clicks on any other link to
force them to go back to HTTP and not over SSL.

I was also needing to rewrite URLS without www to have www. And finally to have my www.domain.com/default.asp
page get redirected to www.domain.com

Here is the .htaccess file that I was working with:

-----START OF HTACCESS FILE---------------------------------------

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.87

RewriteEngine on
RewriteBase /

# force https for /giftcards/default.asp
RewriteCond %{HTTPS} =off
RewriteRule ^giftcards/default\.asp$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# don't do anything for images/css/js (leave protocol as is)
RewriteRule \.(gif|jpe?g|png|css|js)$ - [NC,L]

# force http for all other URLs 
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} !^giftcards/default\.asp$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# rewrite domain.com/default.asp to domain.com/
RewriteRule ^default\.asp$          / [R=301,L]

-----END OF HTACCESS FILE---------------------------------------


I would really appreciate it if anyone could shine some light on what I am doing wrong.

Using this htaccess file when I try to go to the URL www.domain.com/giftcards/default.asp I get the following
message using Google Chrome: Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.


Thanks,
Jason

Edited by jpearce98 - 12 January 2012 at 3:22pm
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 13 January 2012 at 4:02am

Hello Jason,

Lets try to re-arrange the rules and modify them a little:

Code:
# don't do anything for images/css/js (leave protocol as is)
RewriteRule \.(gif|jpeg|png|css|js)$ - [NC,L]

# force https for /giftcards/default.asp
RewriteCond %{HTTPS} !on
RewriteRule ^giftcards/default\.asp$ https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]

# force http for all other URLs
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^giftcards/default\.asp$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# rewrite domain.com/default.asp to domain.com/
RewriteRule ^default\.asp$ / [NC,R=301,L]



In case that won't work, please, provide rewrite.log for the testing request.

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version