我目前的發展是使用CodeIgniter,當我嘗試傳遞一些參數到我的主控制器的索引函數時,它返回我404 error
。CodeIgniter路由問題與控制器的索引功能
http://localhost/gis/1 -> 404 ERROR
http://localhost/gis/home/1 -> 404 ERROR
其實我route.php
文件中有這樣的路線:
$route['default_controller'] = "home";
$route['home/([:num])'] = 'home/index/$1';
我.htaccess
文件是這樣的(從this post帶走的index.php從CI網址):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
而我的config.php
檔案:
$config['base_url'] = "http://localhost/gis";
$config['index_page'] = "";
我在做什麼錯?謝謝!
「routes.php」中的默認控制器是什麼? – Sarfraz 2011-02-27 11:23:49
@Sarfraz我編輯我自己的問題 – 2011-02-27 11:30:54