I would like to redirect all traffic from
www.*.abc.com to *.abc.com without www prefix . i have 1000+ subdomains on the same application which use only one nginx virtual host file in sites enabled directory .
I would like to redirect all traffic from
www.*.abc.com to *.abc.com without www prefix . i have 1000+ subdomains on the same application which use only one nginx virtual host file in sites enabled directory .
You will need to use a regular expression server_name
to capture the part of the domain after the www
. For example:
server_name ~^www\.(?<domain>.*\.example\.com)$;
return 301 $domain$request_uri;
See this document for details.