Rewrite rules with NGinx

Francis Daly francis at
Sun Jan 20 15:50:24 UTC 2013

On Sun, Jan 20, 2013 at 03:22:07PM +0000, Mik J wrote:

Hi there,

Untested, but: it feels nicer to avoid rewrite if possible.

> Action 1:
> I would like that when people access to the system queries the webpage

  location = /nginx {
   # proxy_pass or fastcgi_pass and fastcgi_param, or whatever is appropriate

"appropriate" depends on which non-nginx thing you use to process php.

> Action 2:
> For people who try to access to, they are redirected to

  location = /page.php {
   if (#this_should_redirect) {
    return 302 /nginx;
   # proxy_pass or fastcgi_pass, or whatever is appropriate

"this_should_redirect" might be based on $arg_arg, or on $query_string,
or on something similar.

What should happen for /page.php?arg=other? And for

Francis Daly        francis at

More information about the nginx mailing list