htaccess throwing indefinite redirects

168 views Asked by At

Am trying to have my page redirected to the https using htaccess. At the same time I want that other pages should work on http. Following is my .htaccess code.

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

# Turn SSL on for index.php
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI} \/trimmApp\/index\.php [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L]

# Turn SSL off everything exluding index.php (and some files used on index.php that need to serve through https only)

RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI} !\/trimmApp\/index\.php [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L]

Http to https redirection happens fine, however, htpps redirects to another https://index.php and this happens indefinitely. I tried almost everything possible wrt httpd.cong AllowOveride settings,

following is snapshot of my rewrite log:

10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (4) [perdir /var/www/] RewriteCond: input='80' pattern='!^443$' => matched
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (4) [perdir /var/www/] RewriteCond: input='/check/ping.html' pattern='\/trimmApp\/index\.php' [NC] => not-matched
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (3) [perdir /var/www/] strip per-dir prefix: /var/www/check/ping.html -> check/ping.html
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (3) [perdir /var/www/] applying pattern '^(.*)$' to uri 'check/ping.html'
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70][rid#2b0c83a4cb90/initial] (4) [perdir /var/www/] RewriteCond: input='80' pattern='=443' => not-matched
10.x.x.x - - [24/Oct/2012:06:17:21 --0400] [xyz.com/sid#2b0c835afd70]

Not sure what must be happening. Help would be really appreciated. My linux version is Centos 5.6

0

There are 0 answers