rewrite rule for php easter eggs

Roxis roxis at list.ru
Sun Apr 13 12:31:23 MSD 2008


On Sunday 13 April 2008, mike wrote:
> you need a proper regular expression.
>
> this should match it anywhere in the url, i.e.
> http://site.domain.tld/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
> http://site.domain.tld/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000&foo=bar
>
> it shouldn't just check for ending in it, because the query string
> might still be active even though it has another key/value pair on the
> end of it.
>
> rewrite (.*)PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000(.*) /index.php last;
>
> (i think that should work!)
>
> On 4/13/08, Renaud Allard <renaud at llorien.org> wrote:
> > Hello,
> >
> > I am trying to wrote a rewrite rule to forbid the request of PHP easter
> > eggs.
> >
> > So I'd like the request:
> > http://site.domain.tld/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000
> > to be redirected to index.php
> >
> > I tried:
> > rewrite PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 /index.php last;
> >
> > Or subsets of this one, but it doesn't seem to work. The rewrite doesn't
> > seem to be processed when I access the page.
> >
> > Has someone an idea of why the rule isn't processed?

nginx rewrite uses only URL-path, not URL-path+query_string

to match against query_string use if directive

if ($query_string ~ "blabla") {
    return 403;
}





More information about the nginx mailing list