Problem with url routing in Zend Framework, needs index.php?
As you may know a Zend link should look like this: mydomain.com/index/u开发者_StackOverflow中文版ser for controller index and action user or mydomain.com/category for controller category and action index. But for me in most web hostings I have to use mydomain.com/index.php/category or else it won't find any page at all. It's like it doesn't find it's way in to the indexfile.
My code:
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$router->addRoute('category', new Zend_Controller_Router_Route('category/:pid', array('controller' => 'category', 'action' => 'index')));
so.. mydomain.com/index.php/category/1 works, mydomain.com/category/1 doesn't even find a page.. I'll be very thankful for your help.
Check out the documentation on the standard router which includes a set of mod_rewrite rules which you can place in an .htaccess file in the root directory and which will rewrite requests for mydomain.com/category/1 as a request for mydomain.com/index.php/category/1
http://framework.zend.com/manual/en/zend.controller.router.html
精彩评论