I’m updating a web site I maintain and some of the routes have changed. In particular I have routes that were /development/development-name
that will be /developments/view/development-name
(where there are a number of different development-names).
It looks like the RouteBuilder redirect should be able to do what I want (see api for routebuilder redirect).
I’ve tried a number of different variations on getting this to work. The latest looks something like this but the redirect always fails with the value of n never being passed.
$routes->scope('/', function (RouteBuilder $builder) {
$builder->redirect('/development/{n}', ['controller' => 'Developments', 'action' => 'view'], ['persist' => ['n']]);
.
.
$builder->connect('/developments/view/{n}', ['controller' => 'Developments', 'action' => 'view'], ['pass' => ['n']]);
}
Can anybody advise on what form this should be taking?