This is extremely important for SEO that you do not have your site working for both www and non-www because it will split your ranking between the two as if they were seperate websites
In order to fix this on Nginx the old and outdated way is as follows:
server{
listen 80;
server_name www.westonganger.com;
rewrite ^/(.*)$ http://westonganger.com/$1 permanent;
}
server{
listen 80;
server_name westonganger.com;
...the rest of your server config...
}
The new efficient and proper way is as follows:
server{
listen 80;
server_name www.westonganger.com;
return 301 $scheme://westonganger.com$request_uri;
}
server{
listen 80;
server_name westonganger.com
...the rest of your server config...
}
Take note that these instructions are to point www to non-www, if you would like to point non-www to www then just change the server_names and return statements accordingly.