我一直在尝试在我自己的WAMP服务器上安装Kohana,但一直进入一个死胡同。我一直遵循这里的说明,直到.htaccess文件修改;我重定向指定,但随后得到一个"内部服务器错误",说明这是一个配置错误。我已经尝试了很多组合,我仍然得到相同的错误。
我发现的唯一工作方法是不包括。htaccess文件,只是正确地将bootstrap.php指向正确的路径。这将呈现welcome.php控制器示例,然而,我随后尝试创建一个如上所述的新控制器并输入特定路径(mysite/controller_name),但我得到404 Error。
你知道我哪里错了吗?
bootstrap.php -
Kohana::init(array(
'base_url' => '/shiftrunner/kohana-shiftrunner/',
'index_file' => ''
));
。htaccess -#打开URL重写RewriteEngine
# 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]
您的RewriteBase应该是/shiftrunner/kohana-shiftrunner/
,带有以下斜杠,与引导中的base_url
完全相同。
如果你不想显示,index_file
应该设置为false
,而不是''
。
如果以上不能使它工作,我也会尝试替换
RewriteRule .* index.php/$0 [PT]
RewriteRule .* index.php [L]