if ($host !~ "www.xincanzs.com") { rewrite ^(.*) http://www.xincanzs.com$1 permanent; } 上面将不带www的前缀的访问都重定向带前缀的链接去