Hybris language not being encoded in URL

Viewed 289

I have created my custom storefront b2c electronics and I found out that the LANG is not being persisted in the URL while I navigate through the page.

This is my local.properties site url config:

hac.webroot=/hac
customstorefront.webroot=
customstorefront.webroot=/custom
storefrontContextRoot=
website.custom.http=http\://custom.local\:9001/
website.custom.https=https\://custom.local\:9002/

This are my url patterns:

(?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=custom)(|\&.*)$
(?i)^https?://custom\.[^/]+(|/.*|\?.*)$
(?i)^https?://api\.hybrisdev\.com(:[\d]+)?/rest/.*$
(?i)^https?://localhost(:[\d]+)?/rest/.*$

Am I missing something?

1 Answers

To have the language as part of the Url, you also need to specify that this parameter is part of the UrlEncodingAttributes on your site. You can do this through an impex, or change it through backoffice

For example, something like this

INSERT_UPDATE CMSSite; uid[unique = true]; urlPatterns                             ; urlEncodingAttributes
                     ; $siteUid          ; (?i)^https?://custom\.[^/]+(|/.*|\?.*)$ ; language

If you also want the storefront to be part of the url, you also need to append it in this property like storefront,language.

Do note that the order in which you place the attributes also determines the order in which they appear in the url

Related