views:

270

answers:

2

I have: brand new clean copy of Kohana 2.3.4 (tried 2.4 RC1 also), a controller named 'index' on a Debian with Apache 2.2.9.

When i type address like http://localhost/kohana/index/index i expect controller 'index', action 'index' to be executed. It works on Windows localhost, works on shared hosting. But does not on my Debian server.

I've debugged and found, that $_SERVER['PATH_INFO'] isn't correct. It omits the first 'index' in the URI, so i can get to 'index/index' by going to 'index/index/index'. So that is what i want to fix.

Does anybody know how this could be solved?

A: 

I'm guessing it actually occurs in your .htaccess file or Apache config, not Kohana specifically. First of all, make sure that the example.htaccess file that comes with Kohana is renamed to .htaccess, and you may have to restart Apache.

If you are using .htaccess to hide the index.php part of the path, check to see what the RewriteBase setting is:

RewriteBase /kohana/

If you installed it in the root of your web server (as in production, or using a separate port for localhost), then it should be changed to:

RewriteBase /

This is my own personal most common error in setting up new sites and development environments, by the way. This is also true for CodeIgniter and other related PHP frameworks.

Does your Apache install on the Debian server actually have mod_rewrite? It would be good to confirm that. Here's one way to do that.

Further diagnosis to see if it is Kohana or Apache's fault includes adding back in the index.php portion of the path. In your case, try http://localhost/kohana/index.php/index. Finally, I have to agree with sarfraz above that naming your controller "index" is just begging for trouble. My own convention is to call it "home" and to edit the default route accordingly.

Barnabas Kendall
i dont think this is it actually
I__
A: 

It turned out to be mod_negotitaion. It damn mod rewrites my /index/index to /index.php/index, cause it thought i've missed .php

So anyone who encounter this issue, just disable mod_negotiation and have a good time

charnad