1

Drupal 7, node translation method being used. Having an issue with translated content url aliases right now. Aliases work, language prefixes in urls work, but using the node/# url does not redirect to the node's alias if not in the default language. English is set to the default language.

Example:

English version: node/1 if being viewed goes to its alias, /alias.

French version: node/2 if being viewed does NOT go to its alias, /fr/french-alias, node is viewed correctly at node/2. If you view /fr/french-alias you see the node correctly as well. So you can view the French version of the node two ways when I really want only /fr/french-alias to work and if you go to node/2, I want it to redirect to its alias.

It's like the site is having the issue of applying the language prefix in the url to redirect with. How do I correct this?

1 Answer 1

1

tl;dr: The Global Redirect module with the option Language Path Checking enabled may allow you to enforce redirects for all users.

Node translation can be quite mindboggling. Aliases are stored per language, but that language is determined by the current path language.

With English being your site's default language, if you visit /node/2 instead of /fr/node/2 Drupal will look up the English alias for node/2. Likewise if you visit /fr/node/1, you won't get redirected since Drupal is looking up the French alias (which does not exist).

The Translation Redirect module (part of the Internationalization project) solves this, but with one gotcha:

Note that, by design, translation redirection does not work for the homepage or for authenticated users.

(Link added by me.)

As irritating as this may sound at first: Redirecting editors to a node's language prefix brings with it a host of problems that aren't obvious at first, but can render parts of the backend unusable.

Depending on your translation workflow you may want to consider using the Entity Translation module instead.

1
  • Perfect! Thank you for the thorough answer. I had that enabled as well and it does work, but because I was logged in, nothing was happening. I didn't think to check otherwise. I will write a short snippet to handle authenticated users somehow so they don't link to the non-aliased node url. When looking in the CMS, for the translations, the non-aliased node url is the only one that shows as well. Definitely something that is added as a training issue for users editing content. Anon users will use the provided menus so it isn't an issue for them in this case to navigate to the non-aliased url.
    – user28555
    Commented Oct 12, 2015 at 13:07

Your Answer

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