Dear community,
I'm looking for a way to change the Store View Code to include a hyphen instead of an underscore. Our shop has several Stores (i.e. representing different countries) and with several Store Views (i.e. the available languages). The URL format should look like this:
Example 1 (UK - English): https://www.demostore.com/en-GB/
Example 2 (Germany - German): https://www.demostore.com/de-DE/
Example 3 (Germany - English): https://www.demostore.com/en-DE/
Basically, the format for the Store View Code is as follows: language-COUNTRY
What is the best approach to solving this issue? I could potentially change the Store View Code manually in the DB but I'm not sure whether this will cause other issues down the road.
Thanks!
Solved! Go to Solution.
do not change the store code to en-GB keep them to en_gb
all you need is the URL for your store as :
(UK - English): https://www.demostore.com/en-GB/
you can do that by following these steps:
kindly Accept as a Solution if this works for you and give Kudos
you need to check your document root for Magento
Magento can run from the main folder as well as the pub folder.
it's recommended to run from the pub folder.
assuming you are using pub folder as a document root.
cd magentoRootDir/pub mkdir en-GB cp index.php en-GB/ cp .htaccess en-GB/ cd en-GB/ ln -s ../media ln -s ../static
now open en-GB/index.php
and update the following line
require __DIR__ . '/../app/bootstrap.php'; -> require __DIR__ . '/../../app/bootstrap.php';
do not change the store code to en-GB keep them to en_gb
all you need is the URL for your store as :
(UK - English): https://www.demostore.com/en-GB/
you can do that by following these steps:
kindly Accept as a Solution if this works for you and give Kudos
Thank you for your help!
Sorry, I'm pretty new to Magento (have been working with an ASP.Net e-commerce shop the past 4 years, that's why I need a bit more guidance).
Steps 1 and 2 are clear.
Step 3 (create a folder en-GB) -> I assume create a folder in Magento main file directory, can you confirm?
Step 4 -> I created the above folder in the Magento main file directory and copied index.php and .htaccess over to the en-GB (in my case the folder is called "ch-DE") folder. Can you explain in more detail how I can " update the links into index.php with store code en_gb"?
Step 5 -> Inside the ch-DE directory, I created a directory pub including the two symlinks to the folders /pub/media/ and /pub/static/ (via the terminal and command "ln -s pub/media/ ch-DE/pub/media")
Hope you can further assist.
Cheers
you need to check your document root for Magento
Magento can run from the main folder as well as the pub folder.
it's recommended to run from the pub folder.
assuming you are using pub folder as a document root.
cd magentoRootDir/pub mkdir en-GB cp index.php en-GB/ cp .htaccess en-GB/ cd en-GB/ ln -s ../media ln -s ../static
now open en-GB/index.php
and update the following line
require __DIR__ . '/../app/bootstrap.php'; -> require __DIR__ . '/../../app/bootstrap.php';
I had successfully tested these changes on a dev server and that worked fine. Yesterday, I deployed these changes to our production server and now when navigating between the shops, I get a 404 not found ("Whoops, our bad..."). The URL in the browser changes to "https://www.demostore.com/en-AU/stores/store/redirect/". The only thing I did differently was on the dev server I changed the Base URL to https://www.demostore.com/en-AU/
whereas on the production server I let the Base URL as is and changed the Secure Base URL to https://www.demostore.com/en-AU/ instead
Would you happen to know why I cannot navigate between stores?
Hello, I tried this solution but it's not working for me.
Any other idea on how to bypass this problem? Is it just a matter of changing the validation function, or doing that could cause some other related issue with Magento?