How to redirect to a query

Francis Daly francis at daoine.org
Wed Mar 9 15:02:00 MSK 2011


On Wed, Mar 09, 2011 at 05:50:33AM -0500, sjark wrote:

Hi there,

> Thanks that works! one more question

The main docs are at http://sysoev.ru/nginx/ with useful English-language
content at http://www.nginx.org/en/docs/ and http://wiki.nginx.org/

If you end up guessing the config syntax, could you mention which docs
you read that were unclear? That way, hopefully, they can be fixed --
or the "right" docs made more findable -- so that the next person with
the same difficulty will have an easier time. Thanks!

> can I do something like this if $host = 'one.mysite.com' and $arg_index
> = "" then it should go to one.mysite.com/?index=site&id=1 if
> two.mysite.com it go to two.mysite.com/?index=site&id=2

In nginx, "different host names" usually means "different server{}
blocks". That way, you only have one if() condition to worry about,
which reduces it to a problem already solved :-)


I realise this may be a simplified example, but: if "index" must always
be present and always equal to "site", then perhaps whatever handles
the request could be told to assume that? This is similar to Igor's
"don't redirect; handle it internally" suggestion.

Maybe similar analysis will make your full application configuration be
clear too.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list