Created
August 12, 2016 20:08
-
-
Save mabutler/17d1e6c720abda7b2de27c1ec534f395 to your computer and use it in GitHub Desktop.
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 | |
RewriteBase / | |
# Remove .php extension | |
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php | |
RewriteRule (.*)\.php$ /$1/ [L,R=301] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} ^/(.+)/$ | |
RewriteCond %{DOCUMENT_ROOT}/%1.php -f | |
RewriteRule ^(.*)/$ $1.php [L] | |
# Force trailing slash | |
RewriteCond %{REQUEST_FILENAME}.php -f | |
RewriteRule .*[^/]$ $0/ [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment