We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

nginx rewrite

This is my rewrite code under nginx, I wondered, why when I enter the address Not normal visit Is not an error But direct download?

location /jiazu/ {
    if (!-e $request_filename) {
        rewrite ^/jiazu/(.*)$ /jiazu/public/index.php?_url=/$1;
    }
}

Here's how I serve phalcon in a subfolder with nginx:

location @phalcon {
    rewrite ^/jiazu/public(.+)$ /jiazu/public/index.php?_url=$1 last;
}

location /jiazu/ {
    index index.php;
    if ($uri !~ ^/jiazu/public) {
        rewrite ^/jiazu(.*)$ /jiazu/public$1;
    }
    try_files $uri $uri/ @phalcon;
}


20.5k

Thank you for your answer, I'll try that