routes - Symfony 2, how do I handle routing for multiple domains? -


i have site let create there own site our sub-domain , can use there own custom domain.

user_site:     resource: "routing_user_site.yml"     host:     "{subdomain}.{domain}"     requirements:         domain: %domain%     defaults:         domain: %domain%  # our site site:     host: %domain%     resource: "routing_our_site.yml"     prefix: / 

the above route works fine, i'm not sure how redirect other domains, not our main domain route routing_user_site.yml file

i have added this, doesn't work

custom_site:     host: "{domain}"     resource: "routing_user_site.yml"     prefix: /     requirements:       domain: !(%domain%) 

in symfony2, order of routes important. if 1 route not matched, framework test next.

that means, in case, don't have !(%domain%), put rule without requirement catch other routes.

user_site:     [...] site:     [...] custom_site:     resource: "routing_user_site.yml"     prefix:   / 

if request not catched user_site nor site, catched custom_site ; , user_site , site suggest, custom_site match user's own domain (or, @ least, domain different %domain%).


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -