I have multiple domainnames linked to the same application. They only all redirect to the main tdl nl. Therefore I use the following config and this works fine:
company_core:
resource: "@CoreBundle/Controller/"
type: annotation
prefix: /
host: www.mydomainname.{tld}
defaults:
tld: nl
requirements:
tld: "nl|eu"
Would it be possible that when an user opens the domain www.mydomainname.eu that it will be redirected to www.mydomainname.nl/eu instead-off www.mydomainname.nl ?
It's better to use Apache (or Nginx) for this kind of task:
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to cannonical domain
RewriteCond %{HTTP_HOST} ^www\.mydomainname\.eu [NC]
RewriteRule (.*) http://www.mydomainname.nl/eu/$1 [R=301,NE,L]
</IfModule>