Created
October 23, 2017 11:01
-
-
Save acosonic/403ef2fc9f86a2273f9ae512c85930c7 to your computer and use it in GitHub Desktop.
Apache mod_rewrite .htaccess rule for CakePHP to force HTTPS, but ensure Letsencrypt renew works automatically thru virtualmin
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
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteRule ^.well-known/ - [L,NC] | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
RewriteRule ^$ app/webroot/ [L] | |
RewriteRule (.*) app/webroot/$1 [L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment