0

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...

1 Answer 1

1

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']));
}

Reference

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.