如何使用排除url?状态来自htaccess


How to exclude url with ?state... from htaccess

我写了一个重定向的重写规则

www.domain.com/23/title to www.domain.com?index.php?qa=23&qa_1=title
RewriteRule ^(.*)/(.*)/?$ /index.php?qa=$1&qa_1=$2 [R=301,L]

现在我想将一些url重定向到特殊页面(状态之后的所有内容),例如:

www.domain.com/23/title?state=edit-233 --> www.domain.com/index.php?qa=23&qa_1=title$state=edit-223

我该怎么做?!

所以您想保留现有的查询字符串条目?在"重写规则"中使用[QSA]标志。如果这只是针对某些查询字符串,则可以使用

RewriteCond %{QUERY_STRING}  pattern

选择是否重写。