Welcome! Log In Create A New Profile

Advanced

if( variable exists )

Posted by double 
double
if( variable exists )
April 03, 2012 02:40PM
Hello,

Is there a chance to test if a "$arg_variable" (empty value) exists?
The problem: "if" condition returns "false".

URL:
http://example.com/?variable

nginx.conf:
location / {
if( $arg_variable ) {
rewrite ^.*$ /other-location;
}
}

Thanks a lot
Marcus

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,224860,224860#msg-224860

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Valentin V. Bartenev
Re: if( variable exists )
April 03, 2012 07:00PM
On Tuesday 03 April 2012 16:35:02 double wrote:
> Hello,
>
> Is there a chance to test if a "$arg_variable" (empty value) exists?
> The problem: "if" condition returns "false".
>
> URL:
> http://example.com/?variable
>

if ($args ~ variable) {
...
}

wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
foxman
Re: if( variable exists )
May 17, 2018 11:50PM
if ($arg_user)
{
do as $arg_user exist
bla bla bbla
}

if ($arg_user !~ $arg_user)
{
do as $arg_user not exist
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,224860,279847#msg-279847

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login