1

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?

Nexussim Lements
  • 535
  • 1
  • 15
  • 47

1 Answers1

0

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

Yoni
  • 1,370
  • 7
  • 17
  • I have added it but it's still not showing, any hint? – Nexussim Lements Jan 17 '22 at 08:16
  • Maybe you removed (or customized) the urlEncoderFilter from your beans/filters Can you validate that this filter still exists in your storefront project, and that the filter is in your filterChainList. Out of the box it's in spring-filter-config.xml – Yoni Jan 17 '22 at 12:52