duanlu0075 2013-09-08 05:39
浏览 52
已采纳

没有重写模块在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:

  1. uncommented

    Configure::write('App.baseUrl', env('SCRIPT_NAME'));
    

    in app/config/core.php , because rewrite module is disable.

  2. delete .htaccess file from / and /app and /app/webroot.

  3. 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?

  • 写回答

2条回答 默认 最新

  • dongzhanlu0658 2013-09-08 06:06
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 三菱FX系列PLC串口指令
  • ¥15 cocos的js代码调用wx.createUseInfoButton问题!
  • ¥15 关于自相关函数法和周期图法实现对随机信号的功率谱估计的matlab程序运行的问题,请各位专家解答!
  • ¥15 Python程序,深度学习,有偿私
  • ¥15 扫描枪扫条形码出现问题
  • ¥35 poi合并多个word成一个新word,原word中横版没了.
  • ¥15 【火车头采集器】搜狐娱乐这种列表页网址,怎么采集?
  • ¥15 求MCSCANX 帮助
  • ¥15 机器学习训练相关模型
  • ¥15 Todesk 远程写代码 anaconda jupyter python3