Answer the question
In order to leave comments, you need to log in
Rewrite to nginx?
How to make a redirect from www to a domain without www is understandable.
I wanted to ask for help setting up a redirect from www-subdomains. That is, subdomains are available via www.subdomain.servername.ru , but I would like to redirect them to subdomain.servername.ru
server {
server_name www.servername.ru;
rewrite ^(.+)$ servername.ru$1 permanent;
}
Answer the question
In order to leave comments, you need to log in
server {
server_name ~^www\.(.+)\.example\.com$;
return 301 $1.example.com/$request_uri;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question