Welcome! Log In Create A New Profile

Advanced

Re: Sub-domain in variable

Nikolas Stevenson-Molnar
March 26, 2013 02:20PM
The "www" part is probably causing a problem too. As the regex is
written it will only match "www.<subdomain>.<domain>.<tdl>" which I'm
guessing isn't what you intent. I would instead treat "www" as another
possible subdomain.

~^(?<subdomain>[^\.]*\.)?(?<domain>[^\.]*)\.(?<tld>[^\.*)$

Note I haven't tested this, but it's similar to a pattern I've used. The
$subdomain variable will be either the subdomain, "www", or will be
empty. It would need some more tweaking to handle multiple subdomains
(one.two.domain.com).

_Nik

On 3/26/2013 11:01 AM, huttarichard wrote:
> Thanks lot, but still wont to work.
> And how i set $subdomain to "default" if subdomain doesnt exists?
>
> I try this:
> ~^(www\.)(?<subdomain>[^\.]*)(?<domain>[^\.]*)\.(?<tld>[^\.]*)$
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,237799,237814#msg-237814
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Sub-domain in variable

huttarichard March 26, 2013 08:56AM

Re: Sub-domain in variable

Nikolas Stevenson-Molnar March 26, 2013 12:54PM

Re: Sub-domain in variable

huttarichard March 26, 2013 02:01PM

Re: Sub-domain in variable

Nikolas Stevenson-Molnar March 26, 2013 02:20PM

Re: Sub-domain in variable

huttarichard March 26, 2013 02:42PM

Re: Sub-domain in variable

franciscRO August 02, 2014 07:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready