【问题标题】:No redirect rules processed未处理重定向规则
【发布时间】: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 上发现必须是文本文件。

【问题讨论】:

    标签: angular redirect netlify


    【解决方案1】:

    在尽可能深入地创建此问题的同时。我在 Netlify 中注意到以下消息

    3 new files uploaded
    
       1 generated page and 2 assets changed.
    
       New pages include:
    
       count-your-drinks/index.html
    

    所以我认为这与我的部署文件夹有关(count-your-drinks 是我在 kebab 案例中的项目名称)。我查看了我的 Netlify 构建设置,发现构建文件夹设置为 dist/count-your-drinks。我把它改成了dist

    我还将我的angular.jsonoutputPathdist/count-your-drinks 更新为dist

    这解决了我的问题。

    【讨论】:

      猜你喜欢
      • 2022-01-08
      • 1970-01-01
      • 2018-12-20
      • 2011-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-27
      • 1970-01-01
      相关资源
      最近更新 更多