Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If you have an existing .htaccess file on public_html folder:
- Do not duplicate
RewriteEngine On. - Make sure the lines beginning
RewriteCondandRewriteRuleimmediately follow the already-existingRewriteEngine On.