Angular 4 个 Web App Router 路由无法被 Google Adwords、Mailchimp 识别

Angular 4 Web App Router Routes Not Recognized by Google Adwords, Mailchimp

我在 http://tika.io where all routes seem to be working as they should. For instance, http://tika.io/mink 有一个可用的 Angular 4 站点,在地址栏中输入它时工作正常。所有路由均使用路由器实现。
当我尝试将除基础 url 之外的任何 URL 放入 Google Adwords 和 Mailchimp 重定向服务中的 link 字段以获取确认表单时,我被告知 URL 无效。我试过 /mink 和 /[存在的所有其他 URL],但它们都无效。
由于这两个服务都说 link 无效,我认为该网站可能有问题。感谢任何帮助!

我在 https://angular.io/guide/deployment that talks about "Configure the server to redirect requests for missing files to index.html". There is more specific information here 找到了线索。显然,这是导致此行为的单页应用程序的性质。 接受的答案 为我指明了正确的方向。

如果您加载网页 (tika.io/mink) 并检查网络控制台 (cmd + option + i on Chrome),您会看到对 mink returns 一个 404,即使页面本身加载正常。

对于 Mailchimp,该页面不存在。

要修复它,return 响应 200 而不是 404。在 Amazon 中,按照 this answer or this 文档中的说明创建 Cloudfront 分布。

别忘了将对您域的请求重新指向您的 Cloudfront 域名,而不是以前的任何名称。

部署完毕后,您应该能够重新加载页面并看到它 return 的状态为 200。然后 Google 将识别它。