1

Currently we have a store setup on a single domain with 2 languages. Where the URL's look like this:

Dutch: http://www.example.com/nederlandse_product_url
English: http://www.example.com/english_product_url

When you're in the dutch storeview on the frontend and types in the dutch URL in the address bar, there's no problem. The same for English.

But if you're on the English view and you type in the Dutch URL in the address bar, you get a 404 error.

Is there anyway to check from which storeview the url is and direct the visitor to the correct storeview, without changing the url structure?

12
  • why do you need this? you dont type urls, you just click the link in menu, which is from 100% correct store view..
    – MagenX
    Commented Jan 28, 2016 at 10:24
  • @MagenX: This is needed by a lot of store owners, since the URLs for all store views are indexed by search engines.
    – jhoelzl
    Commented Jan 28, 2016 at 10:27
  • @MagenX, it's what jhoelzl says: Google index the pages with a 404 error. Besides of that, when a store owner gives an direct link to the customer and storeview isn't correct the customer gets a 404 error. Commented Jan 28, 2016 at 10:35
  • could you please post just /url to en and dk products. and are these products the same? available in both shops
    – MagenX
    Commented Jan 28, 2016 at 10:52
  • @MartijnBastiaansen: I had the same issue and wrote a small Magento module for this problem which redirects the user to the correct store view (or best matching store view if the Request-URL is the same for multiple store views). It uses the event controller_front_init_routers.
    – jhoelzl
    Commented Jan 28, 2016 at 11:25

1 Answer 1

0

ive just tested dk/en shop for this issue, and the only difference i found is /store_code/ in url is present and products have the same url for both views.

shop.com/store_dk/product.html
shop.com/store_en/product.html

either you have different url for product in every store or store code is not included?

5
  • As you can see in the original question, there isn't a store code configured in the url as this was a requirement for the shop. That's why there s a problem with the url rewriting and the extension from Jhoelzl is fixing the issue. Commented Jan 29, 2016 at 8:52
  • Yes, the issue only arises if you deactivated storecode for your urls. Mostly, you do not want to have the storecode in the urls.
    – jhoelzl
    Commented Jan 29, 2016 at 8:53
  • SO how do you get into specific store then ? we need to find the bug.
    – MagenX
    Commented Jan 29, 2016 at 9:09
  • Example: I have a website with 1 store and 2 store views (german and english). My category in english is mydomain.com/batteries.html. When i am in this english storeview and type in the browser mydomain.com/akkus.html (same category but german store view) i get an 404 error. I have to first switch to the german store view, than the URL mydomain.com/akkus.html works.
    – jhoelzl
    Commented Jan 29, 2016 at 9:27
  • When you append the value ___store to the request URL, such as mydomain.com/akkus.html?___store=german_storeview_code, then the correct store view is choosen without having to switch the storeview manually. That's what my module does.
    – jhoelzl
    Commented Jan 29, 2016 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.