Force SSL
with simple rule in .htaccess

Even having SSL your visitors enter http instead of https?

26/07/2020

01:12

Some CMS’s allow you to easily activate and use the system with SSL option. For example in WordPress you just have to enter https:// in both fields available under dashboard: settings / general.

Yet sometime you are not using such friendly CMS or maybe even you are a purist using html files based website. What you should do then?

Easy. Just create a file named .htaccess in the root of your website directory containing couple lines you will find below. That’s it.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
fb294782487994678e4bda213eadbb8f?s=96&d=mm&r=g
Michael Skweres

EMAIL:  michal@skweres.net

Webmaster, Designer, System administrator

Post tags: htaccess, Internet, rewrite, rule, ssl

Want to SHARE?


WANT TO HIRE ME?

Leave me your e-mail by clicking the button.

Leave your e-mail

If you have any questions. Leave me your e-mail and I will contact you back as soon as possible.