Apache css/js的默认路由(控制器/操作)和链接不';t工作结块
在访问url时,将cake 2.5.2(在Linux上)解压缩到目录Apache css/js的默认路由(控制器/操作)和链接不';t工作结块,apache,cakephp,Apache,Cakephp,在访问url时,将cake 2.5.2(在Linux上)解压缩到目录/var/www/html/testehttp://localhost/teste它从routes.php正确加载控制器页面的内容和操作显示: Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); 但当尝试通过url直接访问控制器时: http://localhost/teste/pages/disp
/var/www/html/teste
http://localhost/teste它从routes.php
正确加载控制器页面的内容
和操作显示
:
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
但当尝试通过url直接访问控制器时:
http://localhost/teste/pages/display
我没有找到404页的返回
否则,webroot文件夹中的文件css/js/img
生成的Url返回未找到的文件:
http://localhost/teste/css/cake.generic.css
正确访问文件的Url:
http://localhost/teste/app/webroot/css/cake.generic.css
我对css/js/img文件的解决方案如下,我更改了表单以调用该文件
使用的标准表格:
echo $this->Html->css('cake.generic');
新表格:
echo $this->Html->css('/app/webroot/css/cake.generic.css');
简言之,我认为错误实际上可能在apache或其他程序中,但我不知道如何验证该部分
我的css/js/img解决方案正确吗?因为我想这就是我下载的蛋糕版本的例子
如果他们需要更多信息,请告诉我,谢谢。这是禁用mod_rewrite的环境的症状 如果您使用Ubuntu,只需键入:
sudo a2enmod rewrite
在/etc/apache2/apache2.conf中,找到与此类似的a块:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
与
最后,使用以下命令重新启动apache:
sudo service apache2 restart
您是否启用了
mod_rewrite
?
AllowOverride All
sudo service apache2 restart