Redirecting http to https not working as expected
Hi!
I have an SSL certificate in a domain and I want when someone enters my domain as:
With some of these forms redirect to
In the .htaccess I have this:
But it does not work for me, I don't know if I'm forgetting something.
example.com
www.example.com
http://example.com
http://www.example.com
With some of these forms redirect to
https://example.comIn the .htaccess I have this:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
But it does not work for me, I don't know if I'm forgetting something.
-
Hello @Angel Castro, You could try using the following entry in the .htaccess file: RewriteEngine On RewriteCond %{HTTPS} !on RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteCond ${HTTP_HOST} ^domain\.com [NC,OR] RewriteCond ${HTTP_HOST} ^www\.domain\.com [NC] RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
You'd have to replace "domain" with your actual domain name. Let me know if this helps. Thank you.0 -
Hi @cPanelMichael, didn't work, doesn't redirect http to https. Thanks anyway. 0
Please sign in to leave a comment.
Comments
3 comments