We have nginx sitting in front of apache with django deployed.
nginx has a rule for url canonicalization. All non-www urls are redirected to www with the below rule
server {
listen 80;
server_name xyz.com;
rewrite ^/(.*) http://www.xyz.com/$1 permanent;
}
But now we need to set subdomains. on xyz. But all subdomains are now redirecting to www.xyz.com. What could is the exact rule to be added to redirect only xyz.com to www.xyz.com and not redirect abc.xyc.com.