I've been having trouble getting Nginx rewrites to work.
On Apache I had the following rewrite, which directed all requests that did not request a PHP file to index.php:
Options +FollowSymLinks RewriteEngine on RewriteRule !^(.*)\.php$ ./index.php [QSA,L]
The same should work on Nginx, but it does not. This rewrite does nothing (it throws 404 pages for every request):
rewrite !^(.*)\.php$ ./index.php last;
But if I remove the exclamation mark, then the rewrite does work, doing the exact opposite (it redirects all *.php file requests to index.php file):
rewrite ^(.*)\.php$ ./index.php last;
Why doesn't the reverse work in Nginx like the way it does with Apache? What should I change? The one with exclamation mark throws either 404 errors or 'No input file specified.' errors.