1

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

2
  • This is not a Drupal-related question: You do with Drupal in the same way you do it with WordPress running on nginx. Drupal doesn't change the you wrote the nginx configuration file.
    – apaderno
    Commented May 15, 2015 at 5:13
  • To make it clear: "I am using Drupal" doesn't make a question on-topic here. This means you cannot ask here how to enable .htaccess files on Apache because you need it for running Drupal.
    – apaderno
    Commented May 15, 2015 at 5:16

1 Answer 1

0

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;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.