Configuration with hosts, with/without "www." strategy
Closed this issue · 2 comments
picks44 commented
Hello,
My question is in the subject. Here is my config.yml
# Jmsi18nRouting Configuration
jms_i18n_routing:
default_locale: en
locales: [en, de_DE, fr_FR]
strategy: custom
hosts:
en: website.com
de_DE: website.de
fr_FR: website.fr
redirect_to_host: true
If I put a Apache rule like this in my VHost, I have a "ERR_TOO_MANY_REDIRECTS" errors.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^website\.com$ [NC]
RewriteRule ^/(.*)$ http://www.website.com/$1 [R=301,L]
Please advise/help me, so our users can use both website.com and www.website.com to access our website !
picks44 commented
I've also tried with the following config, but this leads to a "ParameterNotFoundException in ParameterBag.php line 94: You have requested a non-existent parameter "website.com"." error.
# Jmsi18nRouting Configuration
jms_i18n_routing:
default_locale: en
locales: [en, de_DE, fr_FR]
strategy: custom
hosts:
en: %website.com%
de_DE: %website.de%
fr_FR: %website.fr%
redirect_to_host: true
picks44 commented
OK, solved this on my own. Kept the Apache config, and changed my config.yml like the following.
# Jmsi18nRouting Configuration
jms_i18n_routing:
default_locale: en
locales: [en, de_DE, fr_FR]
strategy: custom
hosts:
en: www.website.com
de_DE: www.website.de
fr_FR: www.website.fr
redirect_to_host: true