How to force https/ssl using .htaccess



Created By: Jesus Salazar
·
2019-08-20

Tags: #
htaccess
#
ssl
#
https

What to do first

In order to force your website to use https:// instead of http:// you must first purchase and set up your SSL. Next you need to look for or create a .htaccess file for your website. Most website that were created using a platform will come with this file but if your website was created from scratch, then you need to create this file. Note that the file should be named .htaccess as this will not work is you name your file anything else. For example, you can not name it jms.htaccess. Now once that is completed then you can get started.

What to do next

Once you have created or found your .htaccess file you can open it using Notepad++ or any other editor of your choice. Now with the file open copy and paste the following code:

RewriteEngine on

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

Now you simply save your file and it should take into effect.


Are you a visual learner? Check out our quick how to video.


Subscribe 

Subscribe to get updates on new videos,discounts, and more.