My bilingual site works fine, but it is not optimal from a url and SEO perspective because Craft is outputting duplicate content on different paths.

My default locale is en and the secondary locale is cy, this means many English pages can be reached by omitting the local from the path (which is the behaviour I want).

The problem is that certain pages craft generates via the {{ entry.url }} parameter contains the locale in the path even for the default one. i.e., Craft is spitting out paths like http://mysite.com/en/section/entry-title when I'd prefer it to be http://mysite.com/section/entry-title. It's actually accessible from both URLs, which is a bad thing for SEO. I only want the locale parameter added into the path when it's actually needed (i.e., for when we switch to cy).

Is this possible? If not, is there a work-around?

  • 1
    Do you have a folder en/ in your root directory, Matt? – carlcs Oct 13 '14 at 16:50
  • Did you double check that section's entry URL format? – carlcs Oct 13 '14 at 16:56
  • 1
    Good to hear that removing the en/ folder did the trick! – carlcs Oct 14 '14 at 12:07

In your config file you will want to define the locales such that en points to the root directory.

'siteUrl' => array(
    'en' => 'http://craft.dev/',
    'cy' => 'http://craft.dev/cy/'

And your public html folder should not include an 'en' folder:

  • Worked like a charm, thanks - I'd tried this before but neglected to remove the /en directory! – Matt Wilcox Oct 14 '14 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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