Kohana 3.0 安装问题 - 新控制器问题
我一直在尝试在我自己的 WAMP 服务器上安装 Kohana,但遇到了一些死胡同。我已按照说明进行操作 这里直到.htaccess文件修改; 我按指定重定向,但随后收到“内部服务器错误”,指出这是配置错误。我尝试了很多组合,但仍然遇到相同的错误。
我发现的唯一有效方法是不包含 .htaccess 文件,而只是将 bootstrap.php 正确指向正确的路径。 这呈现了我的welcome.php 控制器示例,但是,然后我尝试创建一个如上所述的新控制器并输入特定路径(mysite/controller_name),但出现 404 错误。
有什么想法我哪里出错了吗?
bootstrap.php-
Kohana::init(array(
'base_url' => '/shiftrunner/kohana-shiftrunner/',
'index_file' => ''
));
.htaccess- # 开启URL重写 重写引擎开启
# 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]
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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 RewriteBase 应该是
/shiftrunner/kohana-shiftrunner/
并带有以下斜杠,与引导程序中的base_url
完全相同。如果您不想显示,
index_file
应设置为false
,而不是''
。如果上述方法不起作用,我也会尝试替换
为
Your RewriteBase should be
/shiftrunner/kohana-shiftrunner/
with the following slash, exactly the same asbase_url
in your bootstrap.index_file
should be set tofalse
if you don't want it displayed, not''
.If the above doesn't make it work, I'd also try replacing
with