caddy - 如何在 Caddyfile 中重定向保留路径的某些部分?
问题描述
我想将这样的 URL 重定向
/origin/something
到 this /destination/something
。我尝试使用 来做到这一点redir
,但我无法通过使用占位符获得路径的一部分。然后我尝试用这些方式重写:
rewrite /origin {
r (.*)
to /destination{1}
}
rewrite {
if {path} not_starts_with /origin
to /{path} /{path}/
}
rewrite {
r ^/origin/(.*)
to /destination{1}
}
rewrite {
if {path} not_starts_with /origin
to /{path} /{path}/
}
两种方式都行不通。我究竟做错了什么?我该如何做这个重定向?
解决方案
推荐阅读
- react-native - 控制在平面列表中滚动多远。反应原生
- android - 片段内带有 Tablayout 的 ViewPager2 在 kotlin 中没有显示滑动效果
- artificial-intelligence - 求解具有连续动作空间的多臂老虎机问题
- xml - XSL - 从网络上的目录生成文件列表
- flutter - Flutter Reorderable List 回到原来的状态
- .net-core - ServiceBus 触发器未触发
- angular - Apex图表填充颜色在Angular中面临问题
- php - 在 Magento 1.9 中创建一个给出 404 错误的模块
- neo4j - 使用neo4j在neo4j中查找当前用户不相关的节点
- java - 当 REST API 返回较大的响应时,为什么 Chrome 会关闭连接?