0

I have created a controller "Businesses" and action method call "show_details"

function show_details($id = null,$title = null){
         $this->set('Business', $this->Businesses->findById($id));
         $this->render('Business');
    }

and the current url will be the http://127.0.0.1:8080/caketest/businesses/show_details/1/Hattion_National_Bank_Plc.

But I need to show the Url as http://127.0.0.1:8080/caketest/Hattion_National_Bank_Plc How could I do this? What will be the URL routing rule in routes.php.

I am new to cakePHP so I tried to do this but I failed. your help is highly appreciated.

2

1 Answer 1

0

Add this to your config/routes.php and try hitting the url without method name.

Router::connect('/businesses/*', array('controller' => 'businesses', 'action' => 'show_details'));
Sign up to request clarification or add additional context in comments.

1 Comment

There's no id in the second url, it's not just a route definition. And the route would need to be /* to match the example in the question

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.