0
我在本地主機上的應用程序被設置爲子文檔根目錄,即localhost/mysite。但是,我使用多個模型的分頁。在升級到cakephp-1.3之後,我發現有一個奇怪的問題,即分頁工作正常,頁數小於第10頁,例如: http://localhost/mysite/searches/page:2
工作正常 但http://localhost/mysite/searches/page:10
被重定向到http://localhost/searches
在其他型號中可以找到此問題。CakePHP分頁到第10頁或更多重定向到找不到url
當然,路線不應該造成這種情況,因爲它與其他模型和陽離子是重複的問題。
以下是控制器seraches:
class SearchesController extends AppController {
var $helpers = array('Html', 'Form', 'Paginator');
var $components = array('Session', 'Auth');
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('top', 'index');
}
public function beforeRender() {
parent::beforeRender();
}
function index(){
$this->Search->recursive = 0;
$this->paginate = array('order' => array('times' => 'DESC'));
$this->set('searches', $this->paginate());
}
而且我的網站分頁的工作示例是here從該鏈接嘗試10訪問頁,它將您重定向到搜索控制器的指標!
你有沒有做過一些調試?實際上是否達到了'索引'行動?它實際上是否打到了應用程序?你的'.htaccess'規則是什麼樣的?即使你認爲這與路線無關,你的路線是什麼樣的? CakePHP肯定不會自行發出'301'重定向。 – ndm
@ndm你確實是對的。它是.htaccess我設置了一個規則重定向任何東西/頁:1是任何東西/然而,規則適用於10,11,... 19和100 ... 199等我修好了,一切工作正常。再次感謝你。 – SaidbakR