Multiple conditions for rewrite
Calomel
nginxlist at calomel.org
Wed May 7 21:16:25 MSD 2008
Perl regular expressions should work. Something similar to the
following where we see if the request method is GET or HEAD and deny
the rest.
## Only allow GET and HEAD request methods
if ($request_method !~ ^(GET|HEAD)$ ) {
return 404;
}
Hope this helps,
Nginx "how to" - Fast, Secure and Efficient Web Server
http://calomel.org/nginx.html
--
Calomel @ http://calomel.org
Open Source Research and Reference
On Wed, May 07, 2008 at 07:42:03PM +0300, Andrei GUDIU wrote:
>heya heya
>does anybody know how I could user ngx rewrite to port the mod_rewrite ability
>to have multiple conditions ?
>like:
> RewriteCond cond1
> RewriteCond cond2
> RewriteRule xmoo bla
>
>the current config I am using:
> if (cond1 && cond2) {
> }
>
>does not work (also using &, and does not work)
>
>and:
> if (cond1) {
> if (cond2) {
> }
> }
>
>does not work either :(
>
>Should I use something like the "break"/"last" combinations ?
>
More information about the nginx
mailing list