Rewrites

Hi,

i need to translate this htaccess to nginx:

RewriteCond %{QUERY_STRING} !^/?url
RewriteCond %{QUERY_STRING} !^/?auto
RewriteRule ^(.*)$ /?url=$1 [L]

is this the right solution?

if ($args !~ “^/?url”){
set $rule_0 1$rule_0;
}
if ($args !~ “^/?auto”){
set $rule_0 2$rule_0;
}
if ($rule_0 = “21”){
rewrite ^/(.*)$ /?url=$1 last;
}

cheers,

juergen

On Mon, Oct 10, 2011 at 01:43:34PM +0200, Juergen G. wrote:

is this the right solution?

if ($args !~ “^/?url”){
set $rule_0 1$rule_0;
}
if ($args !~ “^/?auto”){
set $rule_0 2$rule_0;
}
if ($rule_0 = “21”){
rewrite ^/(.*)$ /?url=$1 last;
}

Are you sure, that your requests are somethig like “/some/page?/?auto=1”
?
Could you explain what you want to get ?


Igor S.

if ($args !~ ^(url|auto)) {
rewrite ^(.*)$ http://$server_name/?url=$uri$is_args$args break;
}

Andrejs

Posted at Nginx Forum: