Last active
December 17, 2015 17:09
-
-
Save chrislaskey/5643725 to your computer and use it in GitHub Desktop.
Apache .htaccess configuration for auto-appending `.php` filename extension.
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 | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ $1.php [L,QSA] | |
# The two RewriteCond rules are boilerplate, they make sure files that exist | |
# on the server (CSS, JS, images, etc) will not have their URLs rewritten and | |
# be served directly. | |
# The RewriteRule captures all remaining URL requests, and adds a .php to the end. | |
# The [QSA] flag ensures about.php does not become about.php.php. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment