Home > Website > How to automatically redirect domain from http://... to https://... (redirect via cPanel does not work)

How to automatically redirect domain from http://... to https://... (redirect via cPanel does not work)

You should edit the .htaccess file on the account and enter these lines:


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
 


Where %{HTTP_HOST}% is your domain.com
If you do not have any {REQUEST_URI}, you can delete it.
For example, the 3rd line may look like this:

RewriteRule (.*) https://yourdomain.com
or like this
RewriteRule (.*) https://yourdomain.com/securepage.html