How do I force SSL to be used on my website with cPanel

How do I force SSL to be used on my website with cPanel?

Just having a SSL certificate installed is not enough to make sure that all users use it. You must setup a forced SSL redirect so that anyone who comes to your website is sent to the https:// version.


To do this, simply open up your file manager in cPanel and click the “Settings” option in the top right after navigating to your website’s directory. This is usually “public_html” for the primary domain.

go to settings

This will open a window where you will need to check the option to view hidden files.

show hidden files

Now that this is done you can see if a file called “.htaccess” already exists in your website’s directory. If it does not, create it by hitting the “+ File” option in the top left.

create file option

This will open a window where you can create the file with the correct name and in right folder for your website.

enter file name and location

After creating the file or if you already had it you can “.htaccess” file you can just right click on it and select the “Edit” option.

right click and select edit

Go ahead and click the “Edit” button again after making sure the encoding is correct for your file. It should be utf-8 by default, so you can probably just immediately hit “Edit”.

select edit

At the top of the file (if content already exists) add the following snippet to force SSL redirection for your website and then click “Save”.

RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Congratulations! You now should have all users redirected to the SSL version of your website.

Leave a Reply