Answer the question
In order to leave comments, you need to log in
Help with nginx regex
There is a config, something like this
server {
listen 80;
server_name ~^(?:www\.)?(?P<host_wo_www>.+)$;
server_name_in_redirect off;
resolver 127.0.0.1;
Answer the question
In order to leave comments, you need to log in
I got this:
server_name ~^(?:www\.)?(?P.+)?\.(?P[^\.]+\.[^\.]+)$;
If there are more than 3 parts in the domain, then the "extra" ones go to the subdomain:
abc.def.ghi.ru ->abc.def + ghi.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question