Sub-domain in variable

Nikolas Stevenson-Molnar nik.molnar at consbio.org
Tue Mar 26 16:52:47 UTC 2013


Check your subdomain regex. Right now, if will only work if your
subdomain is a dot ;)

It should be (?<subdomain>[^\.]*) or (?<subdomain>[^\.]+)

_Nik

On 3/26/2013 5:56 AM, huttarichard wrote:
> Hi guys,
>
> I have question. My server_name looks like this:
>
> server_name  ~^(www\.)(?<domain>[^\.]*)\.(?<tld>[^\.]*)$;
>
> but I need, for my website do subdomains. I try:
>
> server_name  ~^(www\.)?(?<subdomain>\.)(?<domain>[^\.]*)\.(?<tld>[^\.]*)$;
>
> but won't work for me. And what will be super, if subdomain  emtpy se to
> default (mean string "default").
>
> Can me anybody help?
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,237799,237799#msg-237799
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list