Allow trailing slash for Symfony2 route without params?

前端 未结 7 1123
时光取名叫无心
时光取名叫无心 2020-12-08 19:08
acme_admin_dashboard:
    pattern:  /{_locale}/admin
    defaults: { _controller: AcmeBundle:Admin:dashboard }

I want this route to be accessible a

相关标签:
7条回答
  • 2020-12-08 19:48

    I like @Kuchengeschmack's answer (https://stackoverflow.com/a/11078348/593957) because it doesn't trigger external redirects.

    Here's a yaml version:

    acme_admin_dashboard:
        pattern:  /{_locale}/admin{trailingSlash}
        defaults: { _controller: AcmeBundle:Admin:dashboard, trailingSlash : "/" }
        requirements: { trailingSlash : "[/]{0,1}" }
    
    0 讨论(0)
提交回复
热议问题