Redirect (301) one route to another from routing.yml in Symfony2

前端 未结 1 1416
生来不讨喜
生来不讨喜 2020-12-12 21:08

I know this is probably trivial, but I couldn\'t find anything on the web or in the Symfony2 reference.

How do I redirect one route to another from routing.yml (with

相关标签:
1条回答
  • 2020-12-12 21:31
    SomeRoute:
        pattern: /someroute
        defaults:
            _controller: SomeBundle:Controller:action
    
    AnotherRoute:
        pattern: /anotherroute
        defaults:
            _controller: FrameworkBundle:Redirect:redirect
            route: SomeRoute
            permanent: true # this is for 301
            page: 5 # you can pass additional attributes
    
    0 讨论(0)
提交回复
热议问题