CakePHP在共享主机public_html上

时间:2011-01-25 16:26:20

标签: php apache cakephp mod-rewrite

我已经在共享主机服务器上安装了cakephp。

我总是收到404错误

mod_rewrite看起来像这样

/home/user/public_html/cms/.htaccess

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

/home/user/public_html/cms/app/.htaccess

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

/home/user/public_html/cms/app/webroot/.htaccess

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

网址为http://server/~user/cms,服务器路径为/ home / user / public_html / cms

1 个答案:

答案 0 :(得分:1)

您必须添加RewriteBase才能从网址中删除http://server/~user/。蛋糕在网址中不起作用