Rewrite regexp for subdomains

António P. P. Almeida appa at perusio.net
Sun Oct 31 03:11:44 MSK 2010


On 30 Out 2010 19h08 WEST, nginx-forum at nginx.us wrote:

> Hi i need to blabla.example.org or dummy.example.org anotherdummy
> send me to www.example.org (another words *.example.org must
> redirect to www.example.org) but when i type www.example.org it
> can't send to www.example.org cause it's loop. Help me to realize
> this construction.

Create two server blocks. Put the www server name before the * and it
should work:

See http://nginx.org/en/docs/http/server_names.html

Exact names precede patterns or regex server names.

--- appa




More information about the nginx mailing list