【发布时间】:2020-10-25 16:31:04
【问题描述】:
我正在制作一个 Angular Web 应用程序(主要基于 this StackOverflow post's answer,但由于某种原因,Netlify 找不到我的重定向,但我看不出我做错了什么。我知道为什么使用 Netlify 的原因找不到我的重定向是因为它确实输出了消息No redirect rules processed。
我使用以下上下文添加了_redirects.txt:
/* /index.html 200
然后我将我的文件作为资产添加到 Angular。
"assets": [
... ,
"src/_redirects.txt" // I also tried removing `.txt`, but file gets find in both cases.
],
我首先在本地构建以查看我的文件是否包含在我的构建中。它确实如此。它也可以在我的 Netlify 部署中找到(我多次下载并手动确认)。
我也尝试过以下事情
-
根据 StackOverflow 帖子Netlify redirect not working,将
http://worthashot.netlify.com/* https://worthashot.netlify.com/:splat 301!添加为我的_redirects.txt文件的第一行。 -
我的
_redirects文件没有文件类型。但是,我在Netlify documentation 上发现必须是文本文件。
【问题讨论】: