I want to remove www.
from both the main site and all sublevel domains. I don't care how many levels into the TLD I am; www
is banned from use. It should issue a 301 redirect.
- www.example.com
- www.123.example.com
I wrote the following server block, but it doesn't seem to work.
server {
listen 80;
server_name ~^(www\.)(?<domain>.+)$;
return 301 $scheme://$domain/$request_uri;
}