user1952811
user1952811

Reputation: 2458

routing includes /index

So I'm wondering in the action_index() function, why does kohana include the index word at the end of the url?

So it ends up being something like this: controller_name/action_name but I don't want index being there. How to disable if action_index()?

Upvotes: 0

Views: 47

Answers (2)

MrP
MrP

Reputation: 346

You need to make action optional in your route like this

Route::set('home', 'home(/<action>)')
        ->defaults(array(
            'controller' => 'Home',
            'action' => 'index'
        ));

now both http://domain_name/home/index and http://domain_name/home will trigger action_index.

Upvotes: 1

mobal
mobal

Reputation: 352

You can easly remove index.php from the url. Open the application/bootstrap.php file and set the index_file to false.

Kohana::init(array(
    'base_url' => '/kohana/',
    'index_file' => FALSE
));

Upvotes: 0

Related Questions