繁体   English   中英

Kohana 404在此服务器上找不到请求的URL /评论

[英]Kohana 404 The requested URL /reviews was not found on this server

在现有kohana环境的顶部设置一个新页面。 我将httpd.config更改为以下内容。

虚拟主机

包括conf / extra / httpd-vhosts.conf

<virtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot "C:/wamp/www/site/kohana"
    ServerName localhost
</virtualHost>
<virtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot "C:/wamp/www/site/kohana"
    ServerName localhost
    <directory "C:/wamp/www/site/kohana">
        Options Indexes FollowSymLinks
        AllowOverride all
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </directory>
</virtualHost>

这使我可以输入localhost并访问该网站的主页。 但是由于某些原因,我只能访问bootstrap.php路由中定义的页面

Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'controller' => 'account',
        'action'     => 'index',
    ));

在我转到“帐户”页面并尝试重定向到其他地方之后。 我从apache收到404错误。 我假设它是来自Apache,因为错误不是从kohana引发的。

Not Found

The requested URL /reviews was not found on this server.

有没有人对我应该看的建议?

我认为您在url中跳过了文件index.php

也许如果您像这样在网络浏览器中键入url,它应该可以工作:

localhost/index.php/<controller>/<action>

不像这样:

localhost/<controller>/<action>

检查,是否已启用apache mod_rewrite并在phpinfo()中加载; 就我而言,我只是在apache启用了mod_rewrite。

 sudo a2enmod rewrite 

然后重启

sudo systemctl restart apache2

检查.htaccess规则。

并确保其中具有Controller_Welcome类,方法。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM