I want all URLs in my application to have a trailing slash. I have the following route in my route.yml:
foo_route:
pattern: /foo/{page}/
defaults: { _controller: FooBundle:Foo:list, page: 1 }
requirements:
page: \d+
Requests to '/foo/1/' work fine, however requests to '/foo/' are not matched because of the trailing slash in the URL pattern.
How can I define routes with trailing slashes and an optional parameter? I am aware I can define 2 different routes for the two cases, but I want to avoid that.