-1

I am working on a project that is on expansion and needs to support multi-domain and multi-language.

I find that the way the standard routing is managed does not cover in an efficient way the project needs.

I found this: https://github.com/alexandresalome/multisite-bundle

It's find it good but I see the following drawbacks: 1) The bundle has not really much movement 2) The routing is set up at Controller/annotation level instead of yml file, what makes project hard to maintain.

Do you know any bundle/strategy based on symfony2 for this need? thanks a lot !!!

Samuel Vicent
  • 991
  • 10
  • 16
  • 1
    what you want to do is pretty easy, in short, let several virtualhosts point to the symfony app and in routing make a hostname condition – john Smith Dec 02 '15 at 09:35

1 Answers1

0

That doesn't solve the problem.

This is my scenario:

I have a parameter where I set up several hosts: landing_hosts, separated by “|”

I have some landings, that are only valid for those hosts, routing: landings

When a request comes, I can’t see any way to dynamically set the current host for the default => hosts entry.

I am forced to specify one, that is %domain%. This works this way because there is a cached file appDevUrlGenerator.php that is created at first time website is visited or ran the command app/cache cache:clear.

If I visit a landing page as host2, the urls and paths created inside twig templates will follow the hosts1 instead hosts2, and this is not valid.

// parameters.yml

parameters:
    landing_hosts: host1|host2
    main_host: host1

// routing.yml

landings:
    host: "{hosts}"
    path:     /
    defaults: { _controller: FrontendBundle:Landings:index }
    requirements:
       hosts: %landing_hosts%
    defaults: 
      hosts: %main_host%
Samuel Vicent
  • 991
  • 10
  • 16