Can't get my site to redirect to https?
I have a legit SSL cert for my site. If I use https it works fine. No errors or warnings. All good. But when I use http it doesn't redirect to https. So I went into my cpanel and setup a perm redirect to https but when I did that Google Chrome complained there was a redirect loop and wouldn't display the page at all. Soon as I removed the redirect it goes back to the same thing as before. I don't want anyone to use http at all, only https. Is there a way to only get https working and ALWAYS redirect to https? I even tried to edit my .htaccess file itself and a redirect error/loop came back again from Chrome. Internet Explorer just wouldn't display anything. Maybe there is a setting in WHM/CPANEL for this?
Thanks.
-
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
Pop that in /home/$username/public_html/.htaccess - That'll redirect any traffic on port 80 (HTTP) to HTTPS. :)0 -
Looks more like the script (I assume PHP) looks for whether you specify HTTP of HTTPS and then does a redirect dependent on the protocol in use. It ideally shouldn't touch your .htaccess :) Without posting your .htaccess file here, there was no way for me to know that the script I provided was what you had. It's always best to provide examples where possible. We can only help as far as the information that is provided. I'm glad you solved the problem. 0 -
EDIT: Well, I found out what the problem was. The installed front end program that was running had a check mark to use https or http and that wasn't checked. Soon as I checked https only it must have made some change in my htaccess file because now I can only access https now.
Hello, I am happy to see the issue is now resolved. Thank you for updating us with the outcome.0
Please sign in to leave a comment.
Comments
5 comments