.htaccess 使用多个查询字符串进行htaccess和mod_重写

.htaccess 使用多个查询字符串进行htaccess和mod_重写,.htaccess,mod-rewrite,query-string,.htaccess,Mod Rewrite,Query String,我目前正在使用htaccess将一个querystring重写为它的页面名,使用以下命令,它工作正常 Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Rewrites urls in the form of /parent/chi

我目前正在使用htaccess将一个querystring重写为它的页面名,使用以下命令,它工作正常

 Options +FollowSymLinks


RewriteEngine on
  RewriteBase /

  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

  # Rewrites urls in the form of /parent/child/
  # but only rewrites if the requested URL is not a file or directory
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
我的问题是,我现在正试图在原始查询字符串的基础上实现额外的查询字符串。我可以通过
/property listing&property=12 Langworthy Royston Grove

但是,我希望能够将
&property=
重写为正斜杠,因此基本上可以删除额外的querystring参数,同时在没有传递额外querystring参数的情况下保持正常的重写规则

谢谢你的帮助


马特。

尝试在上次之前添加此规则:

RewriteRule ^(.+)&property=(.*)$ /index.php?page=$1/$2 [L,QSA]
但是请注意,只有当
&property=
是URI的一部分时(在您展示的示例中是),这才有效,因为只有URI才是重写规则的主题,而不是查询字符串