Last active
September 4, 2020 14:32
-
-
Save meena-erian/4c743848151c8b6ab2dc342ed29af422 to your computer and use it in GitHub Desktop.
Apache configuration to force clients to load resources over secure HTTPS only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RewriteEngine On | |
| # Non-www for portacode.com & remove trailing slashes | |
| RewriteCond %{HTTP_HOST} ^www\.portacode\.com$ [NC] | |
| RewriteRule ^(.*)\/$ https://portacode.com/$1 [L,R=301] | |
| # End Non-www for portacode.com | |
| # Force SSL | |
| RewriteCond %{HTTPS} !on | |
| RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
| Header append Content-Security-Policy: "upgrade-insecure-requests;" | |
| Header append Strict-Transport-Security: "max-age=86400" | |
| # End Force SSL | |
| # All to index.php | |
| RewriteCond %{REQUEST_URI} !^/index\.php$ [NC] | |
| RewriteRule ^(.*)$ /index.php?resource=$1 [L,QSA] | |
| # End All to index.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment