I am Hack Sparrow
Captain of the Internets.

Kohana Route not Working: Kohana gives a 404 Error for Route

Kohana Route fails with a 404 Error

So you are ready to begin your first Kohana project and create your customized Route. You placed the Route right above the default Route created by Kohana and all looks dandy. Then you load the URL and are greeted with a 404 Not Found error! Also you notice it is not the Kohana 404 Error "HTTP_Exception_404".

The Solution

Go to your Kohana directory and find the file named example.htaccess, rename it to .htaccess. Reload the URL to witness the Kohana Route's magic in action!

Kohana uses the Apache mod_rewrite module for doing all those fancy custom URL stuff, but before it can do that, it has to set some rules in a file called .htaccess; since you did not have the .htaccess file, Kohana's Routes failed.

So always remember and preach others: "The first step of setting up a Kohana application is renaming the example.htaccess to .htaccess".


  1. What would happen if mod_rewrite is not enabled on your server?
  2. What is the difference between the 'normal' 404 Not Found error and Kohana's "HTTP_Exception_404" error?

  1. mod_rewrite
  2. .htaccess
  3. Kohana 3 Route

3 Responses to “Kohana Route not Working: Kohana gives a 404 Error for Route”

  1. Mitch says:

    I rename .htaccess and i still getting 404 error… rewrite module is loaded…what to do ?

  2. Erik says:

    Same here. With the .htaccess enabled index/ should be left out of the URL, but for some strange reason the controller and action get mixed up.

    This only happens on a Windows 7 machine with Zend Server as my local server.

    Same website on a WinXP / WAMP install works like a charm.

  3. Captain says:

    Hi Mitch, I would need more detail about the server and the environment to help you with the problem.

Make a Comment