Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/691fb8acdfcd85971cf631e40dd7d1a7 to your computer and use it in GitHub Desktop.
Save daubac402/691fb8acdfcd85971cf631e40dd7d1a7 to your computer and use it in GitHub Desktop.
Force redirect from http to https (editing your .htaccess OR your .conf)
# edit .htaccess way
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# edit .conf way (add into <VirtualHost *:80)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}$1 [R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment