Hello, I'm working on a default server_name that match everything but www.domain.tld then rewrite to www.domain.tld. I use nginx 1.2.1-2.2+wheezy3 with a big regexp.
I have an issu with tld that contain a dot (co.uk co.au net.au, etc...). I must be able to make a difference between domain.co.uk and foo.domain.com first must rewrite www.domain.co.uk second, to www.domain.com Previously, I had this regexp that does not working with any tld that contain a dot : > server_name > ~^((?<subdomain>(w(w[^w]?.*)?)|([^w]?.*))\.)?(?<domain_name>[^.]+)\.(?<tld>[^.]+)$; > rewrite ^ http://www.$domain_name.$tld$request_uri? permanent ; Now I tryto do something like that : > server_name > "~^((?<subdomain>(w(w[^w]?.*)?)|([^w]?.*))\.)?(?<domain_name>[^.]+)(?<tld>((\.[^.]{1-3}\b){1,2}))$"; > rewrite ^ http://www.$domain_name$tld$request_uri? permanent ; But I don't find any clean solution. Is there a solution for that ? or I must still list all domains in my vhost ? Best regards -- Yoann Moulin _______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
