【问题标题】:cake php can't read the url correctlycake php 无法正确读取 url
【发布时间】:2014-04-19 03:12:39
【问题描述】:

我刚买了一个新的专用服务器来制作我的网站

我的网站是用 cake php 和服务器 debian 创建的

当我查看我的网站 www.example. com 它让我摆脱了 html css 和流程,但图像不显示 加载资源失败:服务器响应状态为 404 (Not Found) http://exemple.com/img/logo.png

文件存在于/webroot/img/

网站是http://proveille.com

【问题讨论】:

  • 检查mod_rewrite是否开启?
  • 如何查看?在 unix 中?
  • 如果是 apache,请尝试 phpinfo() 并查看输出中“加载的模块”部分是否有 mod_rewrite
  • mod_rewrite 存在于“加载的模块”中
  • 在这种情况下,检查目录的所有权限是否正确

标签: php cakephp url-rewriting debian


【解决方案1】:
 1. Make sure that an .htaccess override is allowed and that
    AllowOverride is set to All for the correct DocumentRoot.
 2. Make sure you are loading mod_rewrite correctly.
 3. Make sure your copy of CakePHP comes from the downloads section of
    the site or our Git repository, and has been unpacked correctly, by
    checking for .htaccess files.

更多详情请阅读食谱page。

【讨论】:

    【解决方案2】:

    为此在 /app 中编辑您的 .htaccess 文件

    <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteRule    ^$ app/webroot/    [L]
       RewriteRule    (.*) app/webroot/$1 [L]
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 2011-06-29
      • 1970-01-01
      • 2018-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 2012-04-11
      相关资源
      最近更新 更多