How to force the site to use https using .htaccess file? – Knowledgebase

If you’ve working SSL certificate on your website and you’d like force your website to load using ‘https‘ in web-browser then feel free to add the below code in ‘.htaccess‘ file under root directory-

RewriteEngine On

RewriteCond %{HTTPS} off

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

Let me know your thoughts on it!

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat