if ($host != 'domain.tld' ) { rewrite ^/(.*)$ http://domain.tld/$1 permanent; }
if ($host = 'www.domain.tld' ) { rewrite ^/(.*)$ http://domain.tld/$1 permanent; }