In the routing.yml you can do things like:
redirect_old_url_to_new:
pattern: /old-pattern
defaults:
_controller: FrameworkBundle:Redirect:urlRedirect
path: /new-pattern
permanent: true
Which will redirect the url /old-pattern to /new-pattern. However, if I have a parameter, how can the parameter be translated in the new path, e.g.:
redirect_old_url_to_new:
pattern: /old-pattern/{page}
defaults:
_controller: FrameworkBundle:Redirect:urlRedirect
path: /new-pattern/{page}
permanent: true
This is NOT working and will redirect to /new-pattern/{page} literally and will therefore redirect from /old-pattern/23 to /new-pattern/{page}.
If the parameter name is identical, then the parameter will be passed automatically: