Created
September 26, 2018 14:57
-
-
Save ksaylor11/db105746f7e1ba0ef4054d5ba8de6a09 to your computer and use it in GitHub Desktop.
.htaccess rule for hiding .php extensions
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
# this is important! | |
Options FollowSymLinks | |
# Run Php without filename extension | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}\.php -f | |
RewriteRule ^(.*)$ $1.php [NC,L] | |
# Return 404 if original request is .php | |
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" | |
RewriteRule .* - [L,R=404] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment