【问题标题】:htaccess Rewrite Rule duplicate - help me out please / RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]htaccess 重写规则重复 - 请帮帮我 / RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]
【发布时间】:2010-04-09 01:37:23
【问题描述】:

我的 .htaccess 中有这段代码:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]

这会将搜索查询转换为 /keyword+apple+fruit/

没关系..唯一的问题是,如果我输入 /keyword+apple+fruit +any+text+haha+ apple+fruit/ htacces 正在显示内容 - 但我不希望这样。

有什么命令可以说 - ok apple + fruit only 一次在 url 中,第二次发送 404 或什么都不显示..

谢谢!!

【问题讨论】:

    标签: .htaccess mod-rewrite url-rewriting


    【解决方案1】:

    您可以使用RewriteCond 排除这种情况:

    RewriteCond $1 !apple\+fruit
    RewriteRule ^(.*)\+apple\+fruit/$ ?q=$1 [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-16
      • 1970-01-01
      • 2011-04-23
      相关资源
      最近更新 更多