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
Written by Pierre-Louis LAUNAY
Related protips
2 Responses
Add your response
Add your response
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Symfony2
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#