2

On our site, paths are all prefixed by language and country. For example:

http://example.com/en/us/about

In Drupal 7, a previous vendor implemented this by using the Persistent URL module, which rewrites all on-page URLs to include the prefix of your choice. PURL was used to add add the country as a prefix to each path. However, it fails when URL Prefix language negotiation is turned on, requiring a core hack to locale.inc to make both work together to avoid the language negotiation from stomping over our prefix:

@@ -462,7 +462,7@@ -462,7 +462,7 @@ function locale_language_url_rewrite_url(&$path, &$options) {

       case LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX:
         if (!empty($options['language']->prefix)) {
-          $options['prefix'] = $options['language']->prefix . '/';
+          $options['prefix'] = $options['language']->prefix . '/' . $options['prefix'];
         }
         break;
     } 

We are rebuilding the site in Drupal 8, and this is one of the things we need to figure out. Obviously, we'd like to avoid having to reinstate some kind of core hack, but by the same token, we can't change the URL structure due to client requirements.

Is there any way we can pass and preserve both language and country information via path prefixes?

0

you can either use pathauto patterns or pathologic which is still -dev .. to adapt your paths.

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.