I want to change from TLDs to TLD and language code. Right now we have 4 TLDs for our webpage:
example.de
example.com
example.nl
example.fr
Now I want to change our settings of our CMS (Contao) to have only one TDL and language short terms:
example.com/de/
example.com/en/
example.com/nl/
example.com/fr/
Now if you type example.com
, Contao detects the browser language and redirects to the right language short term.
Is this the right way to redirect:
RewriteCond %{HTTP_HOST} example\.de$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /de/$1 [R=301,L]
RewriteCond %{HTTP_HOST} example\.com$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /en/$1 [R=301,L]
RewriteCond %{HTTP_HOST} example\.nl$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /nl/$1 [R=301,L]
RewriteCond %{HTTP_HOST} example\.fr$ [NC]
RewriteRule ^((?![a-z]{2}/).*)$ /fr/$1 [R=301,L]
Now I get redirected to example.de/de/app.php
all the time.