How to Force HTTPS using htaccess File

You know that you should be using HTTPS on your website. You also know that if you do, Google will give your site a little bit of a boost in search results. But how exactly do you go about doing it? Don’t worry, we’ve got you covered. Using the Hyper Text Transfer Protocol (HTTP) standard, websites are able to communicate and send data over the internet.

If a website is not secure, anyone can see what users are looking at or even tamper with their experience. This is why websites should all be running on the HTTPS protocol to ensure their visitors’ browsing experience remains safe and secure.


HTTPS stands for Hypertext Transfer Protocol Secure, which is in turn an implementation of SSL (Secure Sockets Layer). These protocols are all standards that keep your website visitors from viewing sensitive information such as login credentials or payment card details whenever they browse your site.

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

First Login to cPanel

Then Go to Files > File Manager > Public_html

Click on the Settings icon and Check “Show Hidden Files (dotfiles)”

Now search for the .htaccess file.

Click on Edit after Right Clicking on the file.

Just Copy and Paste above code into it and Save it.

That’s it.


Share on:

Leave a Comment