将网站移动到我的本地主机后,蛋糕网站找不到图像或CSS文件?

时间:2013-03-12 08:42:19

标签: cakephp cakephp-1.3

我正在使用cake1.3.5

我最近将一个实时工作站点移到了我的localhost:

enter image description here

我将config.php设置为我的本地数据库但是当我进入该网站时,我看到了:

enter image description here

是否还有其他缺少的步骤(关于文件路径或其他内容)?

2 个答案:

答案 0 :(得分:5)

Cake将所有调用指向webroot文件夹(默认情况下称为URL重写)。这是通过文档根目录中的.htaccess文件实现的,该文件必须具有(用于URL重写才能工作)

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

webroot文件夹中的.htaccess文件应包含

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d   // this line traps requests for directory
    RewriteCond %{REQUEST_FILENAME} !-f   // this line traps requests for file names
    RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>

两行RewriteCond %{REQUEST_FILENAME} !-d&amp; RewriteCond %{REQUEST_FILENAME} !-f在解析目录和文件名请求时至关重要。

RewriteRule ^(.*)$ index.php?/$1 [QSA,L]行处理的不是文件或目录。

  1. 检查是否启用了mod_rewrite。
  2. 必须有两个.htaccess文件,一个在根文件夹中,另一个在webroot文件夹中。这两个.htaccess文件的内容必须不同。
  3. 您可能需要查看URL rewriting

    你可以turn off URL rewriting from Core Configuration

答案 1 :(得分:0)

经历了相同的情况后,事实证明localhost无法识别短样式标记仅在服务器上的php.ini配置文件中启用时才可用。

当我更改标签时,所有页面都正常显示。