为什么这些htaccess指令之一删除查询string,而另一个不?

我正在努力弄清楚为什么这些htaccess指令之一删除查询string和其他不。

RewriteCond %{QUERY_STRING} p=invitations RewriteRule ^index.php$ /Invitations? [L,R=301,QSD] RewriteCond %{QUERY_STRING} p=corporate_invitations RewriteRule ^index.php$ /Invitations/Corporate? [L,R=301,QSD] 

第一个将从像/index.php?l=page_view&p=invitations这样的URLredirect,并正确地重写为/ Invitations

第二,如果您导航到/index.php?l=page_view&p=corporate_invitations,您将被redirect到/ Invitations / Corporate?l = page_view&p = corporate_invitations 。 所以我的问题是为什么第一个删除查询string和第二个不。

– 编辑 –

由于我在Apache 2.4.12上,我删除了? 最后QSD正在为其他线路正常工作。 我添加了更多的规则,唯一一个无法删除查询string的是Invitations / Corporate。 它确实redirect,但留下了查询string。 我认为这可能是在规则的中间,但邀请/党正在正常工作。

整个.htaccess文件是:

 Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{QUERY_STRING} p=corporate_invitations RewriteRule ^index.php$ /Invitations/Corporate [L,R=301,QSD] RewriteCond %{QUERY_STRING} p=invitations RewriteRule ^index.php$ /Invitations [L,R=301,QSD] RewriteCond %{QUERY_STRING} p=message_in_a_bottle_gifts RewriteRule ^index.php$ /GiftBottles [L,R=301,QSD] RewriteCond %{QUERY_STRING} p=party_invitations RewriteRule ^index.php$ /Invitations/Party [L,R=301,QSD] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php%{REQUEST_URI}