mod_rewrite问题

时间:2009-05-21 20:47:50

标签: php apache mod-rewrite

我有以下规则:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico 
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

我的网址如下:

http://www.mydomain.com/189-9544737-0616922?%5Fencoding=UTF8&node=10

on myphp.php

var_dump($_GET): array(3) { 
  ["q"]=>  string(19) "185-8676848-3133633" 
  ["_encoding"]=>  string(4) "UTF8" 
  ["node"]=>  string(2) "10" } 

有什么想法吗?

的问候,

1 个答案:

答案 0 :(得分:0)

尝试添加B修饰符:

  

Apache之前必须先浏览网址   映射它们,所以反向引用会   在他们的时候被转义   应用。使用B标志,   中的非字母数字字符   反向引用将被转义。

RewriteRule ^(.*)$ index.php?q=$1 [B,L,QSA]