Skip to content

Instantly share code, notes, and snippets.

@valeriu
Created July 6, 2017 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valeriu/9f61a60a5689caa13102d62dc0547fef to your computer and use it in GitHub Desktop.
Save valeriu/9f61a60a5689caa13102d62dc0547fef to your computer and use it in GitHub Desktop.
http to https
# Redirect http to https .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
# Redirect http to https apache
<VirtualHost *:80>
ServerName www.example.com
Redirect / https://www.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
# ... SSL configuration goes here
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment