【问题标题】:How to exclude url with ?state... from htaccess如何从 htaccess 中排除带有 ?state... 的 url
【发布时间】:2014-04-15 12:06:56
【问题描述】:

我为重定向编写了一个 RewriteRule

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 重定向到特殊页面(在 ?state 之后的所有内容),例如:

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

我该怎么做?!

【问题讨论】:

    标签: php regex .htaccess mod-rewrite


    【解决方案1】:

    所以您想保留现有的查询字符串条目?在 RewriteRule 中使用 [QSA] 标志。如果这仅适用于某些查询字符串,您可以使用

    RewriteCond %{QUERY_STRING}  pattern
    

    选择是否重写。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-18
      • 1970-01-01
      • 2016-12-09
      • 2012-02-17
      • 2018-01-22
      • 2014-10-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多