首页 > 解决方案 > 在外部文件中重写规则 nginx

问题描述

我正在尝试使用 nginx 重定向一些特定的 url,当我放置规则时我有一个文件,然后我在主机上有一个包含行

myfile.txt(路径是/home/user/Documents/myfile.txt)

rewrite http://mydomain.io/manuales/Manuales/10-BLD1001RGB/files/assets/basic-html/flipbook.html https://mydomain.io/manuales/Manuales/10-BLD1001RGB/files/assets/basic-html/flipbook.html permanent;

在我的主机上

include /home/user/Documents/myfile.txt;

并且不工作,但问题是我有一些其他文件并且工作正常:我有 redirects.txt 相同的路径和这个规则

rewrite ^/10-downlight https://mydomain.io/es/10-focos-circulares permanent;

工作正常。任何想法??

让我说一下这个例子是在本地主机中,因为我在文件上写了规则并且系统管理员在服务器上应用,我没有权限在服务器上编辑主机

标签: redirectnginxurl-redirection

解决方案


推荐阅读