Skip to content

Instantly share code, notes, and snippets.

@andrewjcurrie
Last active May 10, 2023 00:22
Show Gist options
  • Save andrewjcurrie/b4bd8525d57a85387504399962eae637 to your computer and use it in GitHub Desktop.
Save andrewjcurrie/b4bd8525d57a85387504399962eae637 to your computer and use it in GitHub Desktop.
Remove PHP Extension
# HTACCESS for Apache
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
# NGINX Configuration
server {
index index.php;
location ~ \.php$ {
if ($request_uri ~ ^/([^?]*)\.php($|\?)) { return 302 /$1?$args; }
try_files $uri =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment