Closed spointecker closed 3 years ago
the static prefix is about how to store the redirection definitions in the content repository. as long as you don't have name clashes, sharing the prefix should work. if you have name clashes, you are overwriting the document and the last added redirect is the only one that exists.
do your routes set the host parameter? if they don't, they could match paths from other domains.
Yes we set the host parameter (see example above). I get the feeling that we maybe use it "wrong", although it is working for our needs. (redirections only) Maybe you can give me an example how I would configure an example redirect for a given slug to a specific url? (is staticPrefix the right column?)
if they don't, they could match paths from other domains.
Ok, but is it possible to match the same path for different domains?
static prefix
sorry, i mixed up what static prefix is... https://github.com/symfony-cmf/routing-bundle/blob/e7f55a66d1279e9a141690acda061339964a365b/src/Model/Route.php#L40-L41 - this is an implementation detail to help find possibly matching routes. but you don't need to call that method, it should be automatically handled by a listener. is the listener not working in your setup, or are you calling setStaticPrefix manually?
host
the cmf routes are "normal" routes, just not created on the fly in PHP or yaml/xml code, but loaded from a database. if they specify a domain to match, that domain is used, if they don't limit to a domain, they will always match (and the redirection target should stay on the domain that was requested, if i am not mistaken)
you find some examples how redirect routes can be created in this fixture file of the cmf sandbox, maybe that helps you? https://github.com/symfony-cmf/cmf-sandbox/blob/a479131c40ff8af77794d6891096ba74d5346634/src/AppBundle/DataFixtures/PHPCR/LoadRoutingData.php#L160
Thanks for your help @dbu !
I got it working by adding a "random" route_name
.
Hi @dbu
we are using the bundle only for making redirections within Symfony without having to add code.
Our application is used with different domains but only one database, therefore we use one
redirect_route
table for all redirections.We ran into an issue while we tried to have the same
staticPrefix
for differenthost
names. Is this bundle able to redirect to differenturi
with the samestaticPrefix
given, according to the hostname?Example data:
With this sample data, only one redirection would work, the other throws a
404
.Symfony: 4.4 routing-bundle: 2.2.*