fb2dpq
Last Updated: February 25, 2016
·
547
· laupifrpar
86cbce2dd96aeaa66ba9875b7d1d38c4

Symfony2: Redirection in the routing.yml only

Redirect from a route to another with a 301 status code is as easy as

route:
    pattern: /
    defaults: { _controller: FrameworkBundle:Redirect:redirect, route: redirect_to, permanent: true }

redirect_to:
    pattern: /redirect
    defaults: { _controller: Bundle:Controller:action }

That means, when you enter root you'll be redirected to /redirect

Source: http://kiwwito.com/symfony-2-route-redirection/

Say Thanks
Respond

2 Responses
Add your response

19499
3547179be285fedaf4ea10605142a698

do you mean yml?

over 1 year ago ·
19501
86cbce2dd96aeaa66ba9875b7d1d38c4

Yes, sorry I wrote wrong title. But you can write same thing in XML.

over 1 year ago ·