首页 > 解决方案 > 即使在设置了重定向后,ReactJS 应用程序也无法在 AWS Amplify 上使用 www

问题描述

这是我第一次在 AWS Amplify 上部署 React 应用程序。如果我在浏览器中使用https://www.domainxyz.com ,该应用程序可以正常工作,但如果我使用 https://domainxyz.com,它就无法正常工作

我已经在应用程序设置-> 重写和重定向中进行了如下更改,但重定向仍然不起作用。

[
    {
        "source": "https://domainxyz.net",
        "target": "https://www.domainxyz.net",
        "status": "302",
        "condition": null
    },
    {
        "source": "</^((?!.(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$).)*$/>",
        "target": "/index.html",
        "status": "200",
        "condition": null
    },
    {
        "source": "/<*>",
        "target": "/index.html",
        "status": "404",
        "condition": null
    }
]

在此处输入图像描述

标签: reactjsamazon-web-servicesaws-amplify

解决方案


推荐阅读