0

我正在尝试在 1&1 帐户上安装 cakephp,但遇到了问题。

我相信我需要添加

RewriteBase /path/to/cake/app

到 htaccess 文件,但我不知道路径应该是什么。

我已将 cakephp 文件放在一个名为 scissors 的文件夹中,该文件夹位于我可以使用 filezilla 浏览的最底层文件夹中。考虑到这一点,我尝试了

RewriteBase /scissors/app

但这没有用。应该是什么?

编辑

我已经设法让网站工作(有点),但不幸的是,css 似乎没有被加载。我拥有的三个正在工作但没有拉出css的htaccess是:

在/剪刀

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

在剪刀/应用程序中

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

在剪刀/应用程序/webroot

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /app/
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

有谁知道为什么这不能正确加载css?谢谢

4

1 回答 1

1

答案是 cake 2.0,我假设您已经在 public_html 中解压缩了下载的存档,所以 cake 的路径看起来像

/home/your_login/public_html/scissors/files_and_folders_unzipped_here

要不就

/public_html/scissors/files_and_folders_unzipped_here

作为

/home/your_login 

可能不可见。

在“剪刀”文件夹(应用程序、库、插件、供应商等文件夹所在的位置)内放置 .htaccess

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

在“应用程序”文件夹内

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

在“webroot”文件夹中

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

还有另一种安装 cake 的方法(允许在一个“核心配置”上拥有多个站点),但解压缩公用文件夹中的所有内容是最简单的方法。

于 2012-12-28T16:49:56.873 回答