Let’s say i have a controller Articles and an action Search.
I have set the router configuration in routes.php like this:
Router::connect(
'/search/:search_term/*',
array('controller' => 'articles', 'action' => 'search')
);
This way i can see the article titles containing ‘cakephp‘ in search results when i navigate to http://localhost/search/cakephp
But if i navigate to http://localhost/articles/search/cakephp i see the same results.
What i want is to be automatically redirected to
http://localhost/search/cakephp
when i navigate to
http://localhost/articles/search/cakephp
based on the configuration in routes.php.
you have to create .htaccess redirect for that you can’t do it with routes:
OK I found something but not quite sure it will work: