Modx multilanguage multi site installation

416 Views Asked by At

I am looking for help to set rewrite rules in .htaccess. I have multiple websites powered by single Modx installation. For redirecting browser to right context I am using gateway plugin which works good eben without .htaccess modification. The problem has arised when I decided to make one of the hosted websites multilingual. I installed Babel plugin and everything got messed up.

lets say the structure is:

domain1.com
domain2.com
domain3.com/en/
domain3.com/de/

I need to set rules in .htaccess to detect browser language if requested http host is domain3.com and according to detected language add en or de to path.

1

There are 1 best solutions below

0
On

You can try this rule in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)domain3\.com$ [NC]
RewriteCond %{HTTP:Accept-Language} ^([a-z]{2}) [NC]
RewriteRule !^[a-z]{2}/ /%1%{REQUEST_URI} [L,R]