EDIT There is now the possibility of doing this in symfony 2.2
PlatformFooBundle:
resource: "@PlatformFooBundle/Resources/config/routing.php"
domain: foo.testdomain.com
PlatformBarBundle:
resource: "@PlatformBarBundle/Resources/config/routing.php"
domain: bar.testdomain.com
PlatformBazBundle:
resource: "@PlatformBazBundle/Resources/config/routing.php"
domain: baz.testdomain.com
You can use parameters in the domain as well
EDIT OVER
Before marking this as a duplicate, read on
http://www.craftitonline.com/2011/08/symfony2-locale-on-subdomains-not-on-the-url-path/
I've read this article, but it doesnt help me do what im trying to do.
i have 3 different applications that are running on the same domain name, with seperate subdomains. Currently, theya re all running in their own symfony install, and i'd like to get rid of that.
foo.testdomain.com
bar.testdomain.com
baz.testdomain.com
each of these use different bundles
PlatformFooBundle
PlatformBarBundle
PlatformBazBundle
and they each have their own route definitions.
basically, what i want is this
PlatformFooBundle:
resource: "@PlatformFooBundle/Resources/config/routing.php"
subdomain: www|devwww
PlatformBarBundle:
resource: "@PlatformBarBundle/Resources/config/routing.php"
subdomain: bar|devbar
PlatformBazBundle:
resource: "@PlatformBazBundle/Resources/config/routing.php"
subdomain: baz|devbaz
how do i go about doing this?
There is a discussion going on to add this feature.
Have a look at ExperiumDomainedRoutingBundle, which is working really well for me. I haven't added a Bundle-wide domain route (only per controller using annotations), but I would expect that work as well.
Example:
/**
* @Route("/", name="frontend_show", options = {"domain_pattern"="{username}.%base_domain%"})
* @Route("/u/{username}", name="private_show")
* @Template("SiteBundle:Frontend:show.html.twig")
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With