Now when I go to https://localhost:9002/
it opens hac (hybris admin console).
When I go to https://powertools.local:9002/nystorefront/powertools/en/USD/cart
I can reach my storefront.
I want to reach mystore
when I go to localhost:9002
.
What should I do?
You have to configure webroot and storefrontContextRoot in local.properties file.
1) Add properties to your config/local.properties, change mystorefront
(mystorefront.webroot) with your storefront name. Also, need to change hac webroot to /hac
hac.webroot=/hac
mystorefront.webroot=
storefrontContextRoot=
2) To open your site without passing query parameter(?site=mysite), run the below Impex. Change mysite
with your CMSSite name. This will also resolve your error(Cannot find CMSSite associated with current URL).
$siteUid=mysite
# CMS Site
INSERT_UPDATE CMSSite ; uid[unique=true] ; urlPatterns ;
; $siteUid ; (?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=$siteUid)(|\&.*)$,(?i)^https?://$siteUid\.[^/]+(|/.*|\?.*)$,(?i)^https?://[^/].*$ ;
I will assume your web extension name is mystorefront.
Add these into your config/local.properties
# This way hac extension will be available on https://localhost:9002/hac instead of https://localhost:9002/
hac.webroot=/hac
# If you want to remap the context path to the root site on the web container
# then you must set these values to be blank, do not set them to be '/'
mystorefront.webroot=
storefrontContextRoot=
Also make sure that the urlPatterns associated with your CMSSite allow you to access your storefront via: https://localhost:9002/
You can also find this properties and additional information in your mystorefront/project.properties. As already mentioned there, "If you want to change these values then it is suggested that you override both of them in your config/local.properties file rather than changing the value here".
来源:https://stackoverflow.com/questions/50332540/how-to-direct-localhost-to-mystorefront-in-hybris