Removing "index.php" from kohana v3 urls

Now that you have Kohana v3 installed, let’s remove "index.php" from all the URLs to help our SEO capabilities.
Rename the file "example.htaccess" to ".htaccess" or merge its contents if you already have one in place.
You should change the line:

RewriteBase /kohana

to point to the folder where your "index.php" file is.
Next file you will change is "application/bootstrap.php".
You need to change the line:

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

To:

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

My "index.php" file is not on a "kohana" folder, so I changed both "RewriteBase" and "base_url" to "/", as I am gonna user Kohana for all content (except static content).

Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • IGlr