I am working on a project based on cakephp. I just wanted to know How can I make a perfect URL redirection form database value. For example I give here two current URLs and desired URLs
1.Current
/search?vendor=combo-training-certification-courses
1.Desired
combo-training-certification-courses
2.Current
/search?vendor=pmi-training-certification-courses
2.Desired
/pmi-training-certification-courses
Please tell me how can I achieve it...
Just Add following code in config/routes.php
App::uses('ClassRegistry', 'Utility');
$Route = ClassRegistry::init('Vendor'); //MODEL NAME You can change it as your needs.
$routes = $Route->find('all');
foreach ($routes as $route) {
Router::connect('/', array('controller' => $route['Route']['controller'], 'action' => $route['Route']['action']));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.