If there are no alias created by pathauto globalredirect works fine. However, if there are aliases created by pathauto then globalredirect creates bad canonical with duplicated language argument.

The correct canonical would be something like this:
link href="http://www.example.com/pt-br/node_title" rel="canonical"
The bad canonicals has duplicated language argument (/pt-br/pt-br/):
link href="http://www.example.com/pt-br/pt-br/node_title" rel="canonical"

I tested on pathauto-7.x-1.0-rc2

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mac_Weber’s picture

Priority: Normal » Major

changing to major because of SEO problems this issue can bring

Mac_Weber’s picture

I changed line 241 from:

'href' => url(drupal_is_front_page() ? '<front>' : $request_path, array('absolute' => TRUE, 'query' => $query_string)),

to:

 'href' => url(drupal_is_front_page() ? '<front>' : substr($request_path, strlen($prefix)), array('absolute' => TRUE, 'query' => $query_string)),

Canonicals look good now, yet this is far from the best solution. I'm not sure if the problem is on $prefix or 'prefix' on the options array of url()

mrfelton’s picture

Attached patch basically does what was suggested in #2, which seems to work. (This patch is for D6)

mrfelton’s picture

Status: Active » Needs review
Mac_Weber’s picture

mrfelton, this does not really fix the problem.

It just make masquerades the problem. Again, it should be fixed on $prefix or 'prefix' (I don't know exactly which one).

mrfelton’s picture

Yes Mac, please see #1208144: in case of fallback language canonical should point to original language. This issue is tied up with that one, and there is a more complete patch in that ticket.

marcoka’s picture

i can 100% confirm the issue i get the language prefix twice to, like de/de or en/en
It also seems that the metatags module already adds one correctly

...

...

Status: Needs review » Needs work

The last submitted patch, 1205982-globalredirect-duplicate-canonical-prefix.patch, failed testing.

RavindraSingh’s picture

Drupal core provides default canonical URLs for nodes pages, If you have enabled the global redirect for multilingual site you would see this error definitely, even you would see canonical is placed twice in node page.

Canonical URL issue

And I think everysite needs it for SEO. where site owner definitely add meta tags module.
So this would be the good idea to remove canonical code from global redirect module. So I have created a patch for that.

RavindraSingh’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 1205982-caninical.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 1205982-caninical.patch, failed testing. View results

moymilo’s picture

Status: Needs work » Needs review
FileSize
1.22 KB

Re-apply patch on the new code base.

moymilo’s picture