在服务器上安装/设置cakePHP

时间:2012-04-15 19:10:24

标签: cakephp-2.0

我正在尝试在服务器上设置我的cakephp工作 购买godaddy共享服务器

当我访问我的网站时http://xyz.com/cake/ 我收到404错误

The requested URL /xyz/cake/app/webroot/ was not found on this server.

anyhelp plz ??

谢谢,
萨蒂什南比亚

1 个答案:

答案 0 :(得分:5)

如果要在子目录中运行Cake,则需要在RewriteBase中设置正确的.htaccess

/xyz/cake/.htaccess/xyz/cake/webroot/.htaccess(假设/xyz/cake是Cake的路径,您的app dir)需要更新。

/xyz/cake/.htaccess:

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

/xyz/cake/webroot/.htaccess:

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