How to make sure all traffic runs over https?


EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 31.05.2013 14:19:31     Last updated: 07.10.2016 09:11:00

This can be done via several ways, but the easiest is to use mod_rewrite module in Apache by creating .htaccess file in the folder this should apply for. In the file you will need to add the following code:

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

If someone should try a use http protocoll for visit your website they will automatically be redirected via https.

Please note this is only applicable if you have installed an SSL certificate on your web hosting.