redirect - 将子目录重定向到 lighttpd 中的另一个域
问题描述
我正在尝试将子目录重定向到不同的域,最好是 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"
}
}
解决方案
您是否尝试过阅读文档?https://wiki.lighttpd.net/Docs_ModRedirect
url.redirect = (
"^/subdir/whatever/(.*)" => "https://newdomain.com/whatever/$1",
"^/(.*)" => "https://example.com/$1"
)
推荐阅读
- algorithm - 有 3 种方法对其平方进行拆分以获得除数之和的最小数 N 是 N 是多少?
- python - 覆盖 __new__ 以返回初始化对象时如何使用上下文
- visual-c++ - 如何在 Visual std C++ 上编写一些公式(在“类”类型中)
- amazon-web-services - Fargate 的公共 IP 上的 HTTPS - 可能吗?
- javascript - 如何在javascript中使用图像的src更改标识符的url?
- java - 在 RecyclerView 中单击项目的问题
- javascript - 脚本将“=s1400”附加到图像 src 路径,现在图像不会加载
- java - 放心:获取 org.apache.http.ConnectionClosedException:内容长度分隔的消息正文过早结束
- laravel - 如何在 ubuntu 上设置虚拟主机
- javascript - 如何在不向主容器添加滚动的情况下将滚动设置为兄弟孩子