Skip to content

Instantly share code, notes, and snippets.

@brendonexus
Forked from mrl22/.htaccess
Created January 17, 2018 15:20
Show Gist options
  • Save brendonexus/129a6a2310fcaee94c41d7d20970a313 to your computer and use it in GitHub Desktop.
Save brendonexus/129a6a2310fcaee94c41d7d20970a313 to your computer and use it in GitHub Desktop.
No more .php extensions
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# 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