1
主頁正常打開,但當我嘗試導航到我網站上的其他頁面時,出現404錯誤。但是,當我把index.php中的網頁確實正確打開。所有頁面都會顯示404錯誤,但我的主頁除外
在我的配置文件中,我設置了$config['uri_protocol'] = "AUTO";
。
主頁正常打開,但當我嘗試導航到我網站上的其他頁面時,出現404錯誤。但是,當我把index.php中的網頁確實正確打開。所有頁面都會顯示404錯誤,但我的主頁除外
在我的配置文件中,我設置了$config['uri_protocol'] = "AUTO";
。
裏面的config.php
文件:
變化
$config['index_page'] = "index.php";
要:
$config['index_page'] = "";
,並創建一個.htacces
文件,其中包含您的根目錄中:
RewriteEngine On
RewriteBase/
RewriteCond $1 !^(index\.php|assets|fav\.ico|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
如果你想在你的URL中省略index.php,你必須使用[.htaccess文件](http://codeigniter.com/user_guide/general/urls.html)。 – Mischa 2012-08-06 13:36:32