【问题标题】:htaccess multiple directory redirecthtaccess 多目录重定向
【发布时间】:2015-11-13 13:13:33
【问题描述】:

我想知道如何过滤掉多个 URL 列表,并重定向到一个页面。

例子:

www.domain.de/notuse/seite1.html

www.domain.de/dir1/notuse/seite1.html

www.domain.de/dir1/dir2/notuse/seite1.html

我现在想要“notuse”已过滤,因为我是初学者,我不确定这是否正确:

RedirectMatch permanent ^.+notuse/ http://www.domain.de/new-directory/index.html

你有什么建议?

【问题讨论】:

    标签: apache .htaccess redirect directory


    【解决方案1】:

    改变你的正则表达式模式:

    RedirectMatch ^/.*notuse/site1\.html$ http://domain.de/new-dir/index.html
    

    .* 匹配任何字符零次,所以这里它会匹配 /dir1/dir2 如果存在于 Request_uri 中。

    【讨论】:

      猜你喜欢
      • 2012-04-23
      • 1970-01-01
      • 2013-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多