Redirect http to https

How to automatically redirect all your http request to your https website ?
Simply add this 3 lines in your http VirtualHost configuration

RewriteEngine on
RewriteCond %{HTTPS} !^on$ [NC]
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI}  [L]

Don’t forget to activate your rewrite module

a2enmod rewrite

Leave a Reply