0

I am using the following httaccess content, to force rewrite the url's to use https instead of http

RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [L]

But it's always getting, The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address
in a way that will never complete.     
This problem can sometimes be caused by disabling or refusing to accept
cookies.

I've used many other solutions but always getting this...

Abhishek Bhardwaj
  • 242
  • 1
  • 2
  • 8
  • SERVER_PORT might not be conclusive as test here, See also http://stackoverflow.com/questions/4042962/php-http-or-https-how-can-one-tell – mario Oct 27 '12 at 16:39

1 Answers1

1

Try the code below for .htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

#uncomment the below two line if you need to append www
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Abhishek Saha
  • 2,564
  • 1
  • 19
  • 29