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. 

 

  • SSL, HTTPS, htaccess
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Home Screen

  This article is an introduction to the cPanel home screen, which is the place to start for...

What is LiteSpeed?

  LiteSpeed Web Server is a fast, Apache alternative that conserves system resources without...

Sending Email From Your WordPress Site

How to ensure your email gets delivered To send email from your website effectively, we...

How To Login To Your CPanel Account

cPanel is a hosting control panel that allows you to easily manage your hosting account and...

Our Nameservers

In order to use the cPanel DNS, your domain will need to be utilising our name servers which can...