I am trying to rewrite an extensionless server request to the corresponding php file. So far I managed to do so, but I'd like to rewrite php prior to html. I don't know if this makes any sense or not, I was just wondering if it would be possible to get the php-version of a file prior to the html one. My code looks like this, but if I change the location of @extensionless-php whithin the try_files line, it either results in an 404 or a 500 error. My code looks like this:
root path/to/root;
index index.php index.html;
try_files $uri $uri.html $uri/ @extensionless-php;
location ~ .php$ {
try_files $uri =404;
# cgi-params
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
If anyone knows a way to accomplish that or has some further input to this, let me know. Thank you.
