Created
November 1, 2018 10:26
-
-
Save jquery404/5e6d794309b28a0766aa81e5f60e38d5 to your computer and use it in GitHub Desktop.
Remove .php from .htaccess
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
RewriteEngine on | |
# Rewrite /foo/bar to /foo/bar.php | |
RewriteRule ^([^.?]+)$ %{REQUEST_URI}.php [L] | |
# Return 404 if original request is /foo/bar.php | |
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" | |
RewriteRule .* - [L,R=404] | |
# NOTE! FOR APACHE ON WINDOWS: Add [NC] to RewriteCond like this: | |
# RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$" [NC] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment