我正在爲我公司的應用程序使用MVC框架,並使用.htaccess獲取URL變量來管理我的引導程序的路由和變量。它在我的本地機器上運行,通過WAMP運行最新版本的Apache。htaccess忽略/索引/路徑
但是,在我的遠程開發服務器(運行相同版本的Apache).htaccess似乎忽略了對url.com/的請求索引/,但仍能正確識別傳遞給其他路徑的變量,如url/blog /。
測試用例:
URL request: http://url.com/index/login/
$_REQUEST['rt']: null
URL request: http://url.com/index/blah/
$_REQUEST['rt']: null
URL request: http://url.com/blog/view
$_REQUEST['rt']: blog/view
URL request: http://url.com/red/blue/green/orange/
$_REQUEST['rt']: red/blue/green/orange/
在我的WAMP的情況下,從上面的第一個測試返回以下內容:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
:
URL request: http://url.com/index/login/
$_REQUEST['rt']: index/login
這裏的兩臺服務器上正在使用的的.htaccess
我已重新啓動瀏覽器多次,清除我的瀏覽器的緩存,重新啓動,等.....沒有g似乎有所幫助。任何想法,爲什麼會是這種情況?
奇怪。我唯一的解釋是有一個別名指向'/ index /'。你的httpd.conf是否包含任何'別名'指令 – Gerben 2011-12-30 17:58:45