Created
August 12, 2020 09:28
-
-
Save jlabs/e80e786e85bf1928cd58086a7ad8c3d4 to your computer and use it in GitHub Desktop.
Default Craft CMS .htaccess (taken from https://gist.github.com/benlilley/cfc78002013212df85bf4de7ef4a536b)
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
# ---------------------------------------------------------------------- | |
# | 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