Symfony2 Routing: Trailing slash with an optional parameter
my_route:
pattern: /blog/{var}
defaults: { _controller: TestBundle:Blog:index, var: ''}
requirements:
var: ".*"
Match:
/blog
/blog/
/blog/1
Written by Andréia Bohner
Related protips
1 Response
Hello Andreia,
One thing I have a default value?
hello_homepage:
pattern: /hello/{name}
defaults: { _controller: HelloBundle:Default:index, name: Carlos }
requirements:
name: ".*"
How I can do to show name default in myapp.com/hello/ ?
Thanks!!!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Trailing slash
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#