Skip to content

Instantly share code, notes, and snippets.

@devilankur18
Created December 20, 2016 14:59
Show Gist options
  • Save devilankur18/3aa79acfa4894a5a4cb2af19802dc8b2 to your computer and use it in GitHub Desktop.
Save devilankur18/3aa79acfa4894a5a4cb2af19802dc8b2 to your computer and use it in GitHub Desktop.
HTML5 AWS ELB force https
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker/1.0
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L]
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
#RewriteRule ^ index.html [L]
RewriteCond ${REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.html [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment