我确实用codeigniter方式创建了一个重写URL,基本上我用这个模式写了url
my domain / model / controller / varname / varvalue / varname / varvalue
http://mydomain.com/news/detail/idnews/2/myothervar/4/
我使用.htaccess
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
问题是表单获取值是作为查询字符串添加而不是我想像以前的var一样排队
http://mydomain.com/news/detail/idnews/2/myothervar/4/get1/abc/get2/123/
答案 0 :(得分:0)
尝试在RewriteBase /
:
RewriteCond %{THE_REQUEST} \ /+([^\?\ ]+)\?[^\ ]+
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ /$1 [L,R]
RewriteCond %{THE_REQUEST} \ /+([^\?\ ]+)\?[^\ ]+
RewriteCond %{QUERY_STRING} ^([^=]+)=([^&]+)
RewriteRule ^(.*?)/?$ /$1/%1/%2/ [L]