All path aliases are entered by hand. I need them to be language independent. Currently they are created/updated in the language that the user is currently using which does not make sense in case of my site.

I tried using hook_path_insert and hook_path_update but they only receive the $path by value and not by reference and changing the function to hook_path_update(&$path) results in an error.

How to change the language of inserted or updated paths to LANGUAGE_NONE using a module? Alternatively, how can I force all aliases to be language independent automatically when user enters them? I don't think it is not possible; it is possible to allow them to choose the "All" language, but not force it.


If someone needs to have a multi language site, but have all URL aliases language independent (i.e. the same for all nodes and languages), the solution is to create a function:

mymodule_node_validate($node, $form, &$form_state) { 
   $form_state['values']['language'] = LANGUAGE_NONE; 

As a side effect, it also makes all nodes language independent. One possible scenario where this would be useful is:

  • all nodes are created in a custom language which is also the site default language
  • the administration interface is in English (this so far requires multi-language)
  • the administrator users are able to use the same URL aliases as the rest of site visitors, despite the fact that they have English set while the content is in a different language (this requires the trick)

In a real multi-language scenario, URL aliases may need to be different for different languages.


This comment on drupal.org provides exactly what you were looking for.

Create a new module called neutral_paths and make this the content of neutral_paths.module:

 * Implements hook_pathauto_alias_alter().
 * Resets the language before saving the alias
function neutral_paths_pathauto_alias_alter(&$alias, array &$context) {
  // Force all aliases to be saved as language neutral.
  $context['language'] = LANGUAGE_NONE;

This hook is more specific than the one posted in the other answer so it will be called only when needed.

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.