From 38bf06635e240682e376dc689a357bc5c11c137e Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Fri, 5 Feb 2021 15:39:33 +0100 Subject: [PATCH] Extensionless php for API --- server.conf | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server.conf b/server.conf index f4f7cbf..56173ca 100644 --- a/server.conf +++ b/server.conf @@ -61,8 +61,9 @@ server { index router.php; - location \ { - try_files $uri $uri/ $uri.html $uri.php$is_args$query_string; + location / { + try_files $uri $uri.html $uri/ @extensionless-php; + index index.html index.htm index.php; } location ~ \.php$ { @@ -72,6 +73,10 @@ server { fastcgi_pass unix:/run/php/php7.3-fpm.sock; } + location @extensionless-php { + rewrite ^(.*)$ $1.php last; + } + location ~ /\.git { deny all; return 404;