【问题标题】:Exclude specific directory from htaccess redirectmatch从 htaccess 重定向匹配中排除特定目录
【发布时间】:2022-11-27 12:56:49
【问题描述】:

我正在将我的博客从一个子目录迁移到我的域的根目录,但我将管理面板留在其当前位置,因此我需要对匹配以下路径的任何内容执行 301 重定向,“admin/”除外子目录。

我有核心重定向与此一起使用:

RedirectMatch 301 (^/oldblogpath/)(.*) http://www.example.com/$2

我想从上面排除的路径是“/oldblogpath/admin/”——请帮助我理解我遗漏了什么!

【问题讨论】:

    标签: regex .htaccess mod-rewrite


    【解决方案1】:

    您可以为此使用负先行模式:

    RedirectMatch 301 ^/oldblogpath/(?!admin/)(.*) http://www.example.com/$1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-26
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-18
      • 1970-01-01
      • 2012-12-31
      相关资源
      最近更新 更多