Created
January 26, 2013 22:49
-
-
Save nathos/4645164 to your computer and use it in GitHub Desktop.
tweaked .htaccess for automatically removing (and redirecting) URLs with trailing slashes with Statamic (http://statamic.com).
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
RewriteEngine On | |
RewriteRule ^(_app) - [F,L] | |
RewriteRule ^(_config) - [F,L] | |
RewriteRule ^(_content) - [F,L] | |
RewriteRule ^(.*).yml$ - [F,L] | |
RewriteRule ^(.*).yaml$ - [F,L] | |
RewriteRule ^(.*).html$ - [F,L] | |
RewriteRule ^(.*/)?\.git+ - [F,L] | |
# remove trailing slash from URLs | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_URI} (.*)$ | |
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /index.php [QSA,L] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment