【问题标题】:Check url for string and 301 redirect to url without the string检查 url 的字符串和 301 重定向到没有字符串的 url
【发布时间】:2012-05-25 13:36:42
【问题描述】:

我检查了很多 htaccess 重定向,但似乎找不到适合我需要的重定向。我们有一个像这样的旧网址:

www.domain.com/shoes/nike/filter/gender/men

我想要一个规则来检查字符串 'filter' 的 url 并 301 将其重定向到:

www.domain.com/shoes/nike

htaccess 可以吗?

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    这应该可以帮助你:

    RewriteEngine On
    RewriteRule (.*)/filter http://www.domain.com/$1 [R=301,L]
    

    它只是删除“过滤”之后的所有内容

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      • 1970-01-01
      • 2011-10-28
      • 2012-07-21
      • 1970-01-01
      • 2015-07-16
      • 2014-05-20
      相关资源
      最近更新 更多