1

I have some trouble to fix this issue.

I have a Magento 2 installation with two websites and several store views:

https://www.websiteone.com/onenl
https://www.websiteone.com/oneen
https://www.websiteone.com/onede

https://www.websitetwo.com/twonl
https://www.websitetwo.com/twoen
https://www.websiteotwo.com/twode

Magento wants every store view code to be unique, so we've made them unique.

Now I want to rewrite them to shorter urls like:

https://www.websiteone.com/nl https://www.websitetwo.com/nl

But I'm not able to get it working. I tried several things like:

location /onenl/ {
    try_files $uri $uri/ /index.php?$args;
    rewrite ^onenl/(.*)?$ nl/$1 break; 
}

or

location /onenl {
    rewrite ^onenl nl last;
}

I or get a 404 CMS page not found from our base store view. Or I get an nginx 404 not found and in this situation I think he doesn't understand to fire up index.php.

What am I missing? :)

Thanks!

  • Please check with below url, i hope its very helpful to you.. nginx.com/blog/creating-nginx-rewrite-rules stackoverflow.com/questions/36753477/… – Anas Mansuri Aug 3 at 2:43
  • is it only language difference or there are some specific / unique products per store? – MagenX Aug 3 at 8:07
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Manashvi Birla Aug 3 at 10:35
  • @MagenX onlty the languages are different. No other changes. – GuiltyNL Aug 3 at 11:45
  • @AnasMansuri Thank you for the suggestion. I've made several succesful rewrites, and I know how they work. The main issue is, I think, that Magento does not pass the correct store view I also tried: location /ens/ { fastcgi_param MAGE_RUN_TYPE store; fastcgi_param MAGE_RUN_CODE en; rewrite /ens/(.*)?$ /en/$1 last; try_files $uri $uri/ index.php?$args; } But that refers also to the base store view and not the 'en' store view. – GuiltyNL Aug 3 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.