Welcome! Log In Create A New Profile

Advanced

Re: wildcard to rewritre multi domains to www

September 07, 2009 02:14PM
On Mon, 2009-09-07 at 13:44 +0300, Marcus Clyne wrote:
> Hi,
> >> I think if you look at your regex again, you'll see that it's not that
> >> it doesn't match any domains with sub domains, it matches any domains
> >> with a dot somewhere in the middle. The \. guarantees that there's a
> >> dot, but the other characters can be anything.
> >>
> >
> > Ah, so instead of .+ it'd need to be [^.]+ as in:
> >
> > server_name ~(^[^.]+\.[^.]+$);
> >
> That would be fine - for domains with just the top level domain before
> the main name, e.g. test.com. However, if you also deal with URLs with
> a country code as well, e.g. test.co.uk, it's not going to capture them
> because they'll look like the subdomains you were trying to avoid
> capturing. You could create a rather complex RE using all the country
> codes and tld's to fully capture only the main domain, and no
> sub-domains, but it'd be pretty long and would probably waste
> considerable processing time. Personally, I like to keep things simple. :-)

Well, my guess is that there's no general regex that's going to cover
the case of say:

files.domain.com -> files.domain.com
test.co.uk -> www.test.co.uk

I think the OP would have to make a choice based on his subset of
domains or setup special locations for places like files.domain.com
(which would probably be the right solution).

Cliff
Subject Author Posted

wildcard to rewritre multi domains to www

testbot September 05, 2009 10:16AM

Re: wildcard to rewritre multi domains to www

Igor Sysoev September 05, 2009 10:42AM

RE: wildcard to rewritre multi domains to www

testbot September 05, 2009 12:58PM

RE: wildcard to rewritre multi domains to www

Cliff Wells September 05, 2009 04:30PM

Re: wildcard to rewritre multi domains to www

Marcus Clyne September 05, 2009 05:20PM

Re: wildcard to rewritre multi domains to www

Cliff Wells September 06, 2009 02:41PM

Re: wildcard to rewritre multi domains to www

Marcus Clyne September 06, 2009 03:46PM

Re: wildcard to rewritre multi domains to www

Cliff Wells September 06, 2009 08:04PM

Re: wildcard to rewritre multi domains to www

Marcus Clyne September 07, 2009 07:10AM

Re: wildcard to rewritre multi domains to www

Cliff Wells September 07, 2009 02:14PM

RE: wildcard to rewritre multi domains to www

testbot September 05, 2009 05:26PM

Re: RE: wildcard to rewritre multi domains to www

brianmercer September 06, 2009 12:00AM

quick easy .htaccess convert

testbot November 06, 2009 02:12PM

Re: wildcard to rewritre multi domains to www

Igor Sysoev September 06, 2009 12:54AM

Re: wildcard to rewritre multi domains to www

Gena Makhomed September 06, 2009 07:56AM

Re: wildcard to rewritre multi domains to www

Igor Sysoev September 06, 2009 08:04AM

RE: wildcard to rewritre multi domains to www

testbot September 06, 2009 11:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 166
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