php - cakephp - strange issue with routing -
php - cakephp - strange issue with routing -
i have app set go books index page
here address
http://myapp.loc/
here router
router::connect('/', array('controller' => 'books', 'action' => 'index'));
when go http://myapp.loc/
, page loads fine. when click link within page suppose link http://myapp.loc/books/index
, doesn't work.
the web developer tools show
remote address:127.0.0.1:80 request url:http://myapp.loc/books/index request method:get status code:404 not found
i tried adding statement in books controller under index action
die("here breakpoint");
i see when app loads. if take out , allow app load , click on link thats same thing, doesnt nail part of code.
any help appreciated.
router
<?php /** * here, connecting '/' (base path) controller called 'pages', * action called 'display', , pass param select view file * utilize (in case, /app/view/pages/home.ctp)... */ //router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); router::connect('/', array('controller' => 'books', 'action' => 'index')); /** * ...and connect rest of 'pages' controller's urls. */ router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); /** * load plugin routes. see cakeplugin documentation on * how customize loading of plugin routes. */ cakeplugin::routes(); router::mapresources('books', array('id'=>'[0-9a-za-z]')); router::parseextensions('json'); require cake . 'config' . ds . 'routes.php';
try add together sec line like
router::connect('/', array('controller' => 'books', 'action' => 'index')); router::connect('/books/*', array('controller' => 'books', 'action' => 'index')); router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
check manual here
php cakephp cakephp-2.3
Comments
Post a Comment