您的 .htaccess 文件应该如下所示:
/var/www/developer
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/var/www/developer/app
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/var/www/developer/app/webroot
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
您还应该在 /var/www/developer/app/webroot/index.php 中定义正确的路径
代替
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
尝试指定正确的方法(例如 DS . 'www' . 'develop')通常只重新定义 CAKE_CORE_INCLUDE_PATH 就足够了,但有时您需要定义所有三个 ROOT WEBROOT_DIR 和 CAKE_CORE_INCLUDE_PATH