I have a few subdomains that I use in my project, and I would like to have the main marketing site accept www as well as a blank subdomain
http://www.example.com & http://example.com
How can I achieve this with symfony?
This is my current setup
_main:
resource: routing.yml
incompass_sterilization:
host: spd.casechek-dev.com
resource: "@IncompassSterilizationBundle/Resources/config/routes.yml"
incompass_printing:
host: labels.casechek-dev.com
resource: "@IncompassPrintingBundle/Resources/config/routes.yml"
incompass_admin:
host: admin.casechek-dev.com
resource: "@IncompassAdminBundle/Resources/config/routes.yml"
incompass_web:
host: www.casechek-dev.com
resource: "@IncompassWebBundle/Resources/config/routes.yml"
I looked at the documentation here http://symfony.com/doc/current/components/routing/hostname_pattern.html but I can only see how to setup different subdomains that exist, I can't work out how to use an empty subdomain.
edit duplicating the routes does not work, I can't get multiple routes to use the same controller. Here are 2 examples that did not solve the issue
Using the same routes file
incompass_web:
host: www.casechek-dev.com
resource: "@IncompassWebBundle/Resources/config/routes.yml"
incompass_web_two:
host: casechek-dev.com
resource: "@IncompassWebBundle/Resources/config/routes.yml"
Using separate routes files
incompass_web:
host: www.casechek-dev.com
resource: "@IncompassWebBundle/Resources/config/routes.yml"
incompass_web_two:
host: casechek-dev.com
resource: "@IncompassWebBundle/Resources/config/routes_two.yml"
routes.yml
incompass_web_main:
type: annotation
prefix: /
resource: Incompass\WebBundle\Controller\MainController
routes_two.yml
incompass_web_main_two:
type: annotation
prefix: /
resource: Incompass\WebBundle\Controller\MainController