server {
if (!-e $request_finame) {
rewrite ^/(.*) /index.php? last;
}
# or
location / {
if (!-e $request_finame) {
rewrite ^/(.*) /index.php? last;
}
}
}
Actually, I want to ask, the two rewriting rules are the same.
But it is written in location / and directly under the server. What's the difference.
If it is written outside, www.example.com/packages/xxx.apk cannot be downloaded.
If it is inside, www.example.com/packages/xxx.apk, as long as the path exists, it can be downloaded.
I didn't know the reason. Please kind-hearted people can clarify this. Thanks
Saw it in an article.
Nginx Rewrite Research Notes