I'm new in nginx, and I'm trying to configure nginx to rewrite deep directories to php with the name of the first directory in the url. For example:
http://domain.com/news/search/band/ -> news.php
http://domain.com/article/blue/300/?arg=10 -> article.php?arg=10
http://domain.com/xxx/yyy/zzz/ -> xxx.php
I tried with some regular expressions and with:
try_files $uri $uri/ @extensionless-php /index.php?$args =404;
But I haven't had success; could someone help me? Thank you
Replying to myself:
A lot of apache installations have multiviews enabled. You can do this, again, with the try_files directive:
Though it does not exactly do what Multiviews in Apache do, (like making it possible to omit the file extension), in PHP configurations it is 9 times out of ten you need the above behaviour, letting the PHP file handle all requests containing the filename and some slashes appended.