Skip to content

Instantly share code, notes, and snippets.

@mrl22
Created January 17, 2018 15:19
Show Gist options
  • Save mrl22/e6ae06d54e4b205ad157846b0d6cb82c to your computer and use it in GitHub Desktop.
Save mrl22/e6ae06d54e4b205ad157846b0d6cb82c 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