Created
August 14, 2018 20:17
-
-
Save macariojames/cc3d99f7b95583755e027bc03cc7969e to your computer and use it in GitHub Desktop.
Nginx hide .php file extension but make sure the home page -- index.php -- page works
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
# This is in the server {} section of the /sites-available domain | |
location / { | |
#notice the $uri space $uri/ space before the @ function for the re-writes | |
try_files $uri $uri/ @extensionless-php; | |
index index.html index.htm index.php; | |
} | |
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