redirect - 将子域重定向到 ngnix 中的相同子域 url
问题描述
我在应用程序中有多个子域。我想将其中一个子域重定向(mysubdomain.example.com)
到同一子域的 url ( mysubdomain.example.com/fa/news
)
我将此规则添加到 nginx 配置中。
location / {
try_files $uri $uri/ /index.php$is_args$args;
if ($http_host ~ "mysubdomain.example.com")
{
rewrite ^/$ http://mysubdomain.example.com/fa/news permanent;
}
}
当我更改http://mysubdomain.example.com/fa/news;
它http://example.com/fa/news;
的工作原理时,但在同一个子域中它会引发 nginx 404 错误。
我该如何解决?
解决方案
推荐阅读
- javascript - 如何将输入存储在本地存储中
- google-cloud-dataflow - 每当发送特定的发布/订阅消息时,是否可以重新加载删除/重新加载 Bigquery 表?
- json - 可编码的 Swift JSON 解析嵌套的 JSON
- web - hybris 中的网络浏览器
- python - 如何在 pygame 上使用字体系列?
- reactjs - 使用 StackAction 重置后 React Native Back 按钮消失
- python-3.x - Tensorflow:Dataset.from_generate()ValueError:使用序列设置数组元素
- json - Kotlin 中 JSONArray 中的 MutableList
- templates - Prestashop 1.6 - 存储在数据库和订单页面后,“已发货”模板中未显示跟踪号
- google-app-engine - App Engine:如何在本地导入 Datastore