Multi country site in Hybris

2019-07-27 09:36发布

I have a site in my Hybris project having a URL pattern like:

localhost:9002/en-uk

Where the storefront context root was also kept as en-uk in mystorefront project.properties file.

How do I extend this for other countries and create a new site for my new country.I tried changing the existing site impex and changing the URL there but it did not yield anything.

Should I change the storefront context root in mystorefront project.properties file as highlighted above?

标签: hybris
1条回答
女痞
2楼-- · 2019-07-27 10:25

If you have single storefront extension then your storefront context is common for all sites. So I would suggest keeping it as root (/). If you really want to have some storefront context then keep it generic. Do not include countries/language code as it doesn't make sense when someone accesses the US site with /en-uk.


1) Set storefront context to root

  1. Change HAC webroot from / to /hac
  2. Set your storefront webroot & StorfrontContextRoot to blank
  3. Change website & media URL for each cmsStore
  4. Make host file entry for 127.0.0.1 localhost us.local uk.local

In local.properties

hac.webroot=/hac

#change <yourproject> with your storefront extension prefix
<yourproject>storefront.webroot=

#If you are using B2C then below propery would be StorefrontContextRoot
b2bStorefrontContextRoot=

#change usCMSSiteUI with your us CMS site uid and similar for UK
website.usCMSSiteUID.http=http://us.local:9001
website.usCMSSiteUID.https=https://us.local:9002
media.usCMSSiteUID.http=http://us.local:9001
media.usCMSSiteUID.https=https://us.local:9002

website.ukCMSSiteUID.http=http://uk.local:9001
website.ukCMSSiteUID.https=https://uk.local:9002
media.ukCMSSiteUID.http=http://uk.local:9001
media.ukCMSSiteUID.https=https://uk.local:9002

2) Configure each CMSSite with the unique URL pattern

Hope you already have CMSSite instance for each site. For each site, you have to configure the URL pattern.

e.g. enter image description here

UK CMSsite

(?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=UK)(|\&.*)$
(?i)^https?://uk\.local:9002$

US CMSsite

(?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=US)(|\&.*)$
(?i)^https?://us\.local:9002$

3) Start your server and access it

If you have configured your sites correctly as I mentioned above, then you can access it like

https://us.local:9002 https://uk.local:9002

For production setup, you can configure (sub-)domains for each site URL patter or take help of web server to resolve requests by passing ?site=us or uk.

查看更多
登录 后发表回答