I need to redirect (301) urls like this:
I know how to make the slug version of urls work, but I do not want to disable old ones completely, instead I want them to 301-redirect to its slug version. I don’t want them both working simultaneously as it is treated as duplicated content by Google SEO.
I also do not want to write redirect for every product in routes.php like this:
Router::redirect( '/product/view/1001', [ 'controller' => 'products', 'action' => 'view', 'product-1001-name-slug' ] );
Instead I would rather have dynamic lookup function to do it for me.
How can I do it in CakePHP 2.x?