.htaccess - CakePHP doesn't redirect properly -
i've finished getting started tutorial (http://book.cakephp.org/2.0/en/getting-started.html) , put files on apache server, has drupal projet root url.
the cakephp's index page loads fine, when click on item, changing root url root/posts/view/2
, displays drupal's page not found error.
i guess may rewrite problem. cakephp directory has .htaccess file containing :
<ifmodule mod_rewrite.c> rewriteengine on rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule>
and apache2 sites-enabled conf ends :
alias /test /var/www/cakephp/app/webroot <directory /var/www/cakephp/> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> </virtualhost>
when change index action route :
router::connect('/', array('controller' => 'posts', 'action' => 'index'));
to :
router::connect('/foo', array('controller' => 'posts', 'action' => 'index'));
i've got same error described above.
any clue ?
i think problem came rewrite mod. removing 3 .htaccess files allowed me access app urls.
by way, tried on fresh clean apache server following .htaccess files , worked :
/var/www/cakephp/.htaccess
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /cakephp/ rewriterule ^$ app/webroot/ [l] rewriterule (.*) app/webroot/$1 [l] </ifmodule>
/var/www/cakephp/app/.htaccess
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /cakephp/app/ rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule>
/var/www/cakephp/app/webroot/.htaccess
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /cakephp/app/webroot/ rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)$ index.php/$1 [qsa,l] </ifmodule>
Comments
Post a Comment