We run symfony v4.4.3, symfony-cmf 2.1.1 and symfony-cmf/routing-bundle 2.0.0.
We are using the cmf routing to load routes from db.
Symfony 4 should redirect from url with trailing slash to the same url without trailing slash, but it does not happen, trailing slash throws 404.
I started study the code what is happening where and why and I found in generated container router service getter, where is something like this
new DynamicRouter(
new NestedMatcher(
new UrlMatcher()
)
)
UrlMatcher
does not redirect if it is not instance of RedirectUrlMatcherInterface
, but this base one is not.
So I realized it should be possible to inject RedirectableUrlMatcher
to NestedRouter
and I tried to find the way how to do it in documentation, but it was unsuccessful. So I took a look into cmf bundle routing extension, but I cant find any possibility to set specified router, or enable redirect.
But then I noticed RedirectableUrlMatcher
is deprecated...
How to remove trailing slashes?