Saturday 30 June 2018

Apache two apps one domain share language /en - Magento & Wordpress

We have Wordpress in the root / in a physical subfolder /wp and Magento in /products.

We are wanting to make the sites multi-language using sub folders e.g domain.com/en

The problem arises as magento appends the store code (language) after the url so we have

domain.com/en (wordpress)
domain.com/products/en (magento)

Naturally we would like

domain.com/en
domain.com/en/products

Now it's very easy to make it work with some rewrite rule

RewriteRule ^(.*)/products/?(.*)$ /products/$1 [L]

But still we have an issue as Magento generates the links as /products/en it's possible to start modifying where these links are generated like in

\Magento\Store\Model\Store 

In the _updatePathUseStoreView function, this doesn't seem to handle all links though

In general seems like a bad solution, another idea is to use Apache mod_substitute also seems bad practice, and overhead.

Another option is to have both apps in the root and have some lookup logic to see which url belongs to which app.

Any ideas for a setup that can purely use just Nginx/Apache. That does not compromise on having unique url's or regex'ing content.



from Apache two apps one domain share language /en - Magento & Wordpress

No comments:

Post a Comment