I am trying to map friendly URLs to files in a legacy app. There is a file which will receive an action as a parameter to render different sections.
I think that my rewrite condition is wrong because nginx is trying to locate the file including the query string. Here is a section of my conf:
http {
...
map $request_uri $legacy_rewrite {
...
~^/informativos$ /painel.php?act=ver_informativos;
...
}
server {
...
location / {
if ($legacy_rewrite) {
rewrite ^/(.*)$ $legacy_rewrite break;
}
}
}
}
The problem is that I get this error:
[error] 1132019#0: *28724 open() "[my_app_path]/painel.php?act=ver_informativos;" failed (2: No such file or directory)
How should I write this rewrite so nginx would understand that I am referencing painel.php?