Nginx no-www to www and www to no-www

HTTP Solution From the documentation, “the right way is to define a separate server for example.org”: server { listen 80; server_name example.com; return 301 http://www.example.com$request_uri; } server { listen 80; server_name www.example.com; … } HTTPS Solution For those who want a solution including https://… server { listen 80; server_name www.domain.com; # $scheme will get the … Read more