I just installed a SSL certificate on my site, but now I'm facing a problem when I try to force all users to go through secure SSL (HTTPS) instead of HTTP. I found that the way to to it is using the code below on .htaccess
#Force SSL on entire site
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !on [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
So far, it's not working, I get a redirect loop error.
It's redirecting to the SSL URL, but not working.. without the .htaccess rule it works when i type manually https://example.com
I have no idea if this will work for you but I do the same thing for my site and this is the code in my
.htaccess
file. I am sure I got it from somewhere here on Stack Overflow.Try this:
Should work fine...