问题
I've been trying to install Kohana on my own WAMP server but have been running into a bit of a dead end. I've followed the instructions here up until the .htaccess file modification; I redirect as specified but then get an 'internal sever error' stating that it is a configuration error. I've tried a bunch of combinations and I still get the same error.
The only working method I've found is not including the .htaccess file and simply correctly pointing the bootstrap.php to the right path. This renders my welcome.php controller example, however, I then try and create a new controller as mentioned and enter the specific path (mysite/controller_name) but I get 404 Error.
Any ideas where I'm going wrong?
bootstrap.php -
Kohana::init(array(
'base_url' => '/shiftrunner/kohana-shiftrunner/',
'index_file' => ''
));
.htaccess - # Turn on URL rewriting RewriteEngine On
# Installation directory
RewriteBase /shiftrunner/kohana-shiftrunner Protect hidden files from being viewed
<Files .*>
Order Deny,Allow
Deny From All
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]
回答1:
Your RewriteBase should be /shiftrunner/kohana-shiftrunner/
with the following slash, exactly the same as base_url
in your bootstrap.
index_file
should be set to false
if you don't want it displayed, not ''
.
If the above doesn't make it work, I'd also try replacing
RewriteRule .* index.php/$0 [PT]
with
RewriteRule .* index.php [L]
来源:https://stackoverflow.com/questions/5594370/kohana-3-0-installation-problems-new-controller-issues