我在代碼點火器路由時遇到困難。代碼點火器重定向GET參數問題
http://www.mysite.com轉到正確的控制器並做正確的事情。但是,http://www.mysite.com/?ref=p&t2=455會導致404錯誤。另外http://www.mysite.com/mycontroller/mymethod/?ref=p&t2=455工作正常。
我更改了config.php文件中的uri_protocol並嘗試了不同的值。汽車似乎工作得最好。
我的理論是,代碼點火器使用查詢參數來做路由。問題是這些查詢參數與路由無關。
如何讓代碼點火器忽略默認控制器的查詢參數?
請注意,我按照在線說明從URL中刪除了index.php。我不認爲它造成的問題,但這裏是我的.htaccess文件,以防萬一:
RewriteEngine On
RewriteBase /~trifecta/prod/
#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
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]
從'RewriteRule'線,除非你瘋狂的CGI主機或東西卸下問號。 – Zack 2010-07-23 18:49:12