Skip to content

Instantly share code, notes, and snippets.

@monodot
Created March 4, 2016 08:42
Show Gist options
  • Save monodot/56fdf1c2545b780cd0e9 to your computer and use it in GitHub Desktop.
Save monodot/56fdf1c2545b780cd0e9 to your computer and use it in GitHub Desktop.
Redirect from HTTP to HTTPS using rewrite rules
RewriteEngine On
# Redirect from HTTP to HTTPS, by inspecting the HTTP port
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment