2013-07-02 92 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