我在本地主機(Usbwebserver應用程序)上開發了一個站點。我使用笨框架:codeigniter中的mod-rewrite問題
的網址爲 「http://localhost/daniel/index.php」
使用下列選項:
配置/擊潰:
$route['default_controller'] = "site";
配置/配置:
$config['base_url'] = "http://localhost/daniel";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
我試過下面的.htaccess代碼:
RewriteEngine敘述在 RewriteBase/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#如果我們沒有安裝mod_rewrite的,所有404的 #可發送到index.php,一切正常。 #提交人:ElliotHaughin
ErrorDocument 404 /index.php
我想刪除的index.php與http://localhost/daniel加載我的默認控制器。
有什麼建議嗎?
我試過這個,我認爲它的工作,我的意思是http:// localhost/daniel/site重定向到index.php。但它顯示CodeIgniter生成的404頁面未找到。我在index.php的開頭添加了一個回顯,並且正確回顯。認爲在codeigniter設置中存在問題。(幾乎忘記提及我在系統文件夾以外的應用程序文件夾) – Kote 2009-10-13 19:20:33
愚蠢的問題,但你確實有一個名爲「網站」的控制器,對吧? – 2009-10-13 19:25:41
是的,我這樣做。這是我的默認控制器 – Kote 2009-10-13 20:01:59