1

I have the following constellation:

No when I open the website https://example.de.testing.abc.de/en/shop/ I get a 404 on Magento.

$_SERVER['REQUEST_URI'] is /en/shop/ (tried with PHPInfo)

The base URL configuration in Magento is as follows:

+------------------------------+---------+----------+------------------------------------------+
| Path                         | Scope   | Scope-ID | Value                                    |
+------------------------------+---------+----------+------------------------------------------+
| web/secure/base_media_url    | default | 0        | NULL (NULL/"unkown" value)               |
| web/secure/base_static_url   | default | 0        | https://example.de.testing.abc.de/static/  |
| web/secure/base_url          | default | 0        | https://shop.example.de.testing.abc.de/    |
| web/secure/base_url          | stores  | 1        | https://example.de.testing.abc.de/en/shop/ |
| web/secure/base_url          | stores  | 2        | https://example.de.testing.abc.de/de/shop/ |
| web/unsecure/base_media_url  | default | 0        | NULL (NULL/"unkown" value)               |
| web/unsecure/base_static_url | default | 0        | NULL (NULL/"unkown" value)               |
| web/unsecure/base_url        | default | 0        | https://shop.example.de.testing.abc.de/    |
| web/unsecure/base_url        | stores  | 1        | https://example.de.testing.abc.de/en/shop/ |
| web/unsecure/base_url        | stores  | 2        | https://example.de.testing.abc.de/de/shop/ |
| web/url/redirect_to_base     | default | 0        | 0                                        |
+------------------------------+---------+----------+------------------------------------------+

First question

Can Magento 2 determine from the base URL configuration which store to run?

I am afraid it doesn't ... so I set also the store code

Further configuration

I am setting in NGINX a header X-MAGE_RUN_CODE=en and check for this header in the Apache Vhost. Then I set the MAGE_RUN_CODE env variable appropriately.

Second Question

It is still not working - I still get a 404. I verified, that MAGE_RUN_CODE is passed to Apache (via phpinfo() again). MAGE_RUN_TYPE is set to store.

I think Magento tries to find a route /en/shop ? How can I avoid that? Do I have to use rewrites in NGINX or is Magento capable of doing so?

update: Third Question

When I set the proxy to go to the URL / it works - no more 404 page. But only if FPC is disabled. If FPC is enabled, I do not get the other language version when changing URLs. Also the language switch appends a __store=en when switching languages. How can I get it working with FPC on?

Seems to be related to https://github.com/magento/magento2/issues/4556

0

I partially solved it by using

            rewrite ^/en/shop(.*)$ $1?__store=en break;

and

            rewrite ^/de/shop(.*)$ $1?__store=de break;

Now only the language switcher is misbehaving.. opening a second question for this.

Your Answer

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

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