【发布时间】:2014-03-10 15:45:03
【问题描述】:
我刚刚完成了入门教程 (http://book.cakephp.org/2.0/en/getting-started.html) 并将我的文件放在一个 Apache 服务器上,该服务器以 Drupal projet 作为根 URL。
Cakephp 的索引页面加载正常,但是当我单击任何项目时,将我的根 url 更改为 root/posts/view/2 之类的东西,它显示 Drupal 的 page not found 错误。
我猜这可能是一个重写问题。我的 CakePHP 目录有一个 .htaccess 文件,其中包含:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
我启用 apache2 站点的 conf 以 :
结尾Alias /test /var/www/cakephp/app/webroot
<Directory /var/www/cakephp/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
当我更改索引操作路线时:
Router::connect('/', array('controller' => 'posts', 'action' => 'index'));
到:
Router::connect('/foo', array('controller' => 'posts', 'action' => 'index'));
我遇到了与上述相同的错误。
有什么线索吗?
【问题讨论】:
标签: .htaccess cakephp mod-rewrite rewrite cakephp-routing