nginx - NGINX 将 URL 保存在 /location/some-path 并提供 /location/?
问题描述
这可能吗?
用户输入https://mywebsite.com/location/any-path
Nginx 运行https://mywebsite.com/location/
URL 显示https://mywebsite.com/location/any-path
这种类型的动作也有特定的名称吗?
解决方案
您希望proxy_pass
将请求发送到另一个 url,然后proxy_redirect
更改显示给客户端的 url。
像这样的东西:
location ~ /location/(.+) {
resolver 8.8.8.8;
proxy_pass https://mywebsite.com/location/index.php;
proxy_redirect /location/ /location/$1/;
}
推荐阅读
- r - 试图找到一种方法将来自 R 中 3 个不同 mirt 模型的 IRT 信息图组合在一起
- javascript - 如果一定数量的数字已经有值,则阻止用户在输入字段中输入数字
- c# - 如果数组元素与文本框匹配,则更新文件的行
- reactjs - Reactjs FormControl 日期
- java - 使用 Java 将 AWS 文件上传到 S3
- javascript - 使用地理数据提交后检查选定的国家和城市
- ios - 尝试使用 coreData 保存我的事件时,有人能看到我缺少什么吗?
- while-loop - 如何在VBS中制作一个始终打开的输入框?
- mongodb - MongoDB 从 3.6 升级到 4.0:如何修复“collection does not have uuid in kvcatalog”异常?
- django - PostgreSQL全文搜索:由多行组成的文档