【问题标题】:redirect a subdirectory to another domain in lighttpd将子目录重定向到 lighttpd 中的另一个域
【发布时间】:2021-07-21 23:22:29
【问题描述】:

我正在尝试将子目录重定向到不同的域,最好是 https。我有一些重定向规则来转发到 http 到 https 及其工作,但我希望一个特定的子目录转发到另一个域。它应该将 example.com/subdir/whatever 转发到 newdomain.com/whatever

  $HTTP["host"] =~ "example.com" {
    accesslog.filename         = "/var/log/lighttpd/example.com/access.log"
    url.redirect = ( "^/(.*)" => "https://example.com/$1" )
    server.name                 = "example.com"
  }
}

【问题讨论】:

    标签: redirect lighttpd


    【解决方案1】:

    您是否尝试过阅读文档? https://wiki.lighttpd.net/Docs_ModRedirect

    url.redirect = (
      "^/subdir/whatever/(.*)" => "https://newdomain.com/whatever/$1",
      "^/(.*)" => "https://example.com/$1"
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 2014-06-26
      • 2019-08-22
      • 2014-07-03
      • 2019-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多