2

I am using cakephp 3. I want to hide frontends controller in url.

My Routes config:

Router::connect('/:action', array('controller' => 'frontends'));

And I want to refer all function to bloggers controller when url start as www.example.com/bloggers

Router::connect('/bloggers/:action', array('controller' => 'bloggers'));

But www.example.com/bloggers also refers to frontends Controller's index function. It should refer to bloggers Controller's index function. Any help?

Oops D'oh
  • 941
  • 1
  • 15
  • 34
Abdus Sattar Bhuiyan
  • 3,016
  • 4
  • 38
  • 72

1 Answers1

5

Just change the order of your routing

First write this

Router::connect('/bloggers/:action', array('controller' => 'bloggers'));

and then this one

Router::connect('/:action', array('controller' => 'frontends'));
Pradeep Singh
  • 1,282
  • 2
  • 19
  • 35