Kohana 3.0 安装问题 - 新控制器问题

发布于 2024-10-31 04:48:57 字数 1157 浏览 1 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攒一口袋星星 2024-11-07 04:48:57

您的 RewriteBase 应该是 /shiftrunner/kohana-shiftrunner/ 并带有以下斜杠,与引导程序中的 base_url 完全相同。

如果您不想显示,index_file 应设置为 false,而不是 ''

如果上述方法不起作用,我也会尝试替换

RewriteRule .* index.php/$0 [PT]

RewriteRule .* index.php [L]

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]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文