2013-07-02 91 views
1

我想使基於codeigniter的網站能夠將index.php?option = test & controller = con1轉換爲/ test/con1使用.htaccess我試着找到多個示例似乎沒有工作,它直接進入主頁。有任何想法嗎?apache htaccess codeigniter查詢字符串路徑

我已經嘗試過類似的事情

RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$ 
RewriteRule ^\/(.+?)\/(.+?)\/? /index.php/$1/$2 [L] 

,但不會引發任何錯誤或任何東西。 我目前htacces是

RewriteEngine on 
RewriteCond $1 !^(index\.php|images|css|img|js|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 

回答

0

嘗試把這個的.htaccess在同一目錄與index.php文件

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|images|robots\.txt) 
RewriteRule ^(.*)$ /index.php/$1 [L] 
+0

移動的RewriteCond的一個不同點? – Shawn

+0

只是試圖用我上面提供的 –

+0

替換你當前的htaccess。我確實沒有看到任何區別,仍然忽略了GET參數。 – Shawn