Created
January 5, 2018 19:23
-
-
Save heyjoecampbell/660d2c10241cc8e8a632c819a7988267 to your computer and use it in GitHub Desktop.
Remove .php File Extension and Force Trailing Slash (perfect for static Bootstrap websites)
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
## Remove .php -and- Force Trailing Slash | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}\.php -f | |
RewriteRule ^(([^/]+/)*[^./]+)/$ $1.php | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ | |
RewriteRule (.*)$ /$1/ [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment