Jeff
Jeff

Reputation: 6140

Kohana controller URI basics

Re: Kohana v2.3.4.

Do I have to create a new controller for every URL which uses segment 2? In other words, if I want my URLs to be:

... do I need to create a unique controller for foo and a unique controller for bar? I'd like to create just one controller, if possible.

EDIT:

I'd like to avoid redirection at all costs, if possible.

Upvotes: 0

Views: 556

Answers (3)

MarcoBarbosa
MarcoBarbosa

Reputation: 58

You do need to have a controller for every segment 2 , but if you only want a "foo" controller than you should use routing.

Upvotes: 0

erenon
erenon

Reputation: 19148

You can set up your router to redirect bar to foo. Don't forget to send http/302, in order to not confusing crawlers. Google doesn't like if more url's point to the same resource.

Upvotes: 0

Garrett
Garrett

Reputation: 8090

From here: http://docs.kohanaphp.com/general/routing

It looks like you can do:

$config['foo'] = 'controller/action'; // access at /foo
$config['bar'] = 'controller/action'; // access at /bar

Upvotes: 3

Related Questions