HTTPS Redirect

Redirecting HTTP -> HTTPS

Once you've installed your SSL - you need to ensure that anyone visiting the insecure HTTP version of the site is automatically redirected through to the secure, HTTPS version. To do this we can use a .htaccess redirect. You'll need to the either use File Manager within cPanel, or connect to your site via FTP to edit the files. 

Locate the .htaccess file within the public_html (or whatever you've set doc root to, if you've changed it) and open it for editing. At the top of the file add the below snippet: 

RewriteEngine on
RewriteRule ^.well-known/ - [L,NC]
RewriteRule "(^|/)\." - [F]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This snippet will redirect all traffic from HTTP -> HTTPS whilst allowing anything in the .well-known folder to ignore this rule, in order to validate Lets Encrypt certificates. 

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)