2011-01-21 111 views
0

正如你可能知道的Zend鏈接應該看起來像這樣:mydomain.com/index/user控制器索引和操作用戶或mydomain.com/category控制器類別和操作索引。但對於我在大多數虛擬主機中,我必須使用mydomain.com/index.php/category否則它根本找不到任何頁面。這就像它沒有找到它的方式進入索引文件。Zend Framework中的URL路由問題需要index.php?

我的代碼:

$frontController = Zend_Controller_Front::getInstance(); 
$router = $frontController->getRouter(); 
$router->addRoute('category', new Zend_Controller_Router_Route('category/:pid', array('controller' => 'category', 'action' => 'index'))); 

所以.. mydomain.com/index.php/category/1作品, mydomain.com/category/1甚至沒有找到一個網頁..我會非常感謝您的幫助。

+2

mod_rewrite enabled? .htaccess創建? – KingCrunch 2011-01-21 10:48:59

回答

0

查看標準路由器上的文檔,其中包含一組mod_rewrite規則,您可以將其放在根目錄中的.htaccess文件中,並將mydomain.com/category/1的請求重寫爲mydomain的請求.com/index.php/category/1

http://framework.zend.com/manual/en/zend.controller.router.html

+0

謝謝..我把它與KingCrunch的提示一起工作,從http://framework.zend.com/manual/en/project-structure.rewrite.html獲得一些幫助:) – Martina 2011-01-21 11:26:19