Created
January 27, 2023 02:00
-
-
Save 3m1n3nc3/c243ed233ed325f35cee23261a69e3d4 to your computer and use it in GitHub Desktop.
Hidding .php and .html file extension from URL on Nginx
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
location / { | |
try_files $uri $uri.html $uri/ @extensionless-php; | |
index index.html index.htm index.php; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
} | |
location @extensionless-php { | |
rewrite ^(.*)$ $1.php last; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment