没有重写模块在cakephp中找不到css文件
I'm having a problem with CakePHP, the CSS is not found. When I view the source code in my browser I can see the cake generic CSS link in the head section. But when I click on it to see the actual source code, I get a 404 not found error.
i follow this actions:
-
uncommented
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
in app/config/core.php , because rewrite module is disable.
delete
.htaccess
file from/
and/app
and/app/webroot
.- run project.
php code in default is :
app/View/Layouts/default.ctp
echo $this->Html->css('cake.generic');
and its html code is:
<link rel="stylesheet" type="text/css" href="/app/webroot/css/cake.generic.css" />
this file exist really, but when i click to /app/webroot/css/cake.generic.css
in source of browser code i face
404 Not Found
Is way?
我遇到CakePHP问题,找不到CSS。 当我在浏览器中查看源代码时,我可以在head部分看到cake通用CSS链接。 但是当我点击它以查看实际的源代码时,我得到404未找到的错误。
i遵循以下操作: p>
-
取消注释 p>
Configure :: write('App.baseUrl',env('SCRIPT_NAME')); code> pre>
在app / config / core.php中,因为重写模块已禁用。 p> li>
从
/ code删除
.htaccess code>文件 >和
/ app code>和
/ app / webroot code>。 p> li>
- 运行项目。 li> ol>
默认情况下,php代码为: p>
app / View / Layouts / default.ctp p> blockquote>
echo $ this-&gt; Html-&gt; css('cake.generic'); code> pre> \ n
及其html代码为: p>
&lt; link rel =“stylesheet”type =“text / css”href =“/ app / webroot / css / cake .generic.css“/&gt; code> pre>
这个文件确实存在,但当我点击
/app/webroot/css/cake.generic.css code>我面临的浏览器代码来源 code> p>
404 Not Found p> blockquote>
是吗? p> div>
I'm assuming your virtual hosts document root points to app/webroot
so your links to the css files need to point to /css/file.css
. The way you have it now it's actually looking for app/webroot/app/webroot/css
and that's why you get a 404.
Either that or your .htaccess is wrong or you stylesheet doesn't actually exist. Let me know if this helps and i can update my answer if needed.
Already,i face this problem. i change permission for app and webroot and css folders. i offer this for you too.