Created
April 22, 2018 22:47
-
-
Save benlilley/cfc78002013212df85bf4de7ef4a536b to your computer and use it in GitHub Desktop.
Default Craft CMS .htaccess
This file contains 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
# ---------------------------------------------------------------------- | |
# | Cleaning URLs | | |
# ---------------------------------------------------------------------- | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Remove www from URL's | |
RewriteCond %{HTTP_HOST} ^www\.(.+) | |
# RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+) | |
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301] | |
# Make all traffic go over https | |
# RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Remove trailing slashes | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)/$ /$1 [L,R=301] | |
# Send would-be 404 requests to Craft | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC] | |
RewriteRule (.+) index.php?p=$1 [QSA,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment