How to force redirect user to www.domain or http://domain in a nginx environment? I'm using drupal with nginx and i'm looking for a way to redirect users either to www.domain.tld or to http://domain.tld

Right now, if i log into the website using http://domain.tld, the website considers me as an anonymous user and i need to log in again when accessing www.domain.tld

I know drupal's .htaccess file manages this issue but it's ineffective with nginx

Thanks
I wouldn't think that Drupal would handle it any different that another setup, ie.. creating another entry for the non-www version with a redirect:

server {
  listen       80;
  server_name  example.com;
  return       301 http://www.example.com$request_uri;
}

server {
  listen       80;
  server_name  www.example.com;
}