Skip to content

Instantly share code, notes, and snippets.

@thim81
Forked from nurtext/.htaccess
Created May 8, 2019 07:04
Show Gist options
  • Save thim81/0a6319757806dc179c2b51b4c0ef3b1c to your computer and use it in GitHub Desktop.
Save thim81/0a6319757806dc179c2b51b4c0ef3b1c to your computer and use it in GitHub Desktop.
Tell apache we're on HTTPS if reverse proxy is serving the site using SSL
# Let apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
# Redirect to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IFModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment