1

I have an issue with URL aliases creation. I have set my configuration as following:

See image

The default path pattern above is the only one configured. Yet, when I create my content type instances and translate them, I get the following:

http://mysite.localhost:8082/en/search-form
http://mysite.localhost:8082/fr/fr/recherche-de-mots
http://mysite.localhost:8082/ab/ab/dfghdf

EN is the default language, but why do I get double /fr/fr and /ab/ab? These are the links created in the language link available under node contents.

REM: Generate automatic URL alias is set on all node content translations.

Update

Of course, I would like to avoid repetitions (this is my real question):

http://mysite.localhost:8082/en/search-form
http://mysite.localhost:8082/fr/recherche-de-mots
http://mysite.localhost:8082/ab/dfghdf

2 Answers 2

1

That happens because Drupal is using the language prefix to generate the language URLs, and you are using the [node:language] token in the path pattern. As consequence, the language prefix appears twice.
In the first case, as English is the default language, the prefix doesn't appear twice because [node:language] is replaced from an empty string.

Just use [node:title], instead of [node:language]/[node:title] as path pattern.

The reason for allowing the use of [node:language] is that the other method to generate language URLs is through a domain for a specific language. Suppose you set http://exemple.com has domain for the French language; with your path pattern, the URL alias would be something like http://exemple.com/fr/recherche-de-mots, which is perfectly acceptable.

3
  • Ok, but then how do I get to have them only once for each link? Mar 13, 2012 at 22:22
  • I tried to use [node:title], instead of [node:language]/[node:title] as path pattern, but it just removes one level of language in the path, meaning EN is now mysite.localhost:8082/search-form instead of mysite.localhost:8082/en/search-form Mar 13, 2012 at 22:50
  • 1
    Ok, I found out there was no 'Path prefix language code' set for English (default Drupal install), I just had to add 'en' in Home > Administration > Configuration > Regional and language > Languages for English, and now it works. Thanks! Mar 13, 2012 at 23:00
0

There's also the possibility to rewrite the results of your path-field, and select "Use absolute link" (not to be confused with the similar option under "rewrite as link").

It gave me the right result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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