If I have WWW prefix handling enabled, direct navigation to a node (or any path) with a www. prefix drops the whole path and goes to the front page.

Live examples:

http://supportunitedway.org/youth/msti - works
http://www.supportunitedway.org/youth/msti - pops back to the homepage

On another server:

http://apexic.net/node/10 - works
http://www.apexic.net/node/10 - pops back to the homepage

In both cases, if I turn WWW prefix handling off, the second address works. I don't have any weird mod rewrites. I've got a wildcarded virtual server working. I will keep checking my server settings, but I wanted to see if anyone else had experienced this. That it is happening on two different servers makes me think it's a module thing. It's very odd to me since the only place I can see this gets applied is a simple bit of code in domain_init():

  if (variable_get('domain_www', 0)) {
    $_subdomain = str_replace('www.', '', $_subdomain);
  }

Comments

agentrickard’s picture

Confirmed bug. But this was sort of by design. The intent was to bounce users from www.example.com to example.com when they mistype a URL. But this does not account for links written by others -- or legacy links in search engines.

If you edit line 63 of domain.module, it should work as expected.

Old code:

  if ($raw_domain != $_subdomain) {
    drupal_goto($_domain['path']);
  }

New code:

  if ($raw_domain != $_subdomain) {
    drupal_goto(domain_get_uri($_domain));
  }
agentrickard’s picture

Status: Active » Needs review
gcassie’s picture

That seems to do it. Thanks very much for your help, yet again.

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community
agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD and 5-dev.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.