我有一个使用构建的SPA create-react-app,希望有一个robots.txt,如下所示:
create-react-app
http://example.com/robots.txt
我在此页面上看到:
在将服务器配置为从目录提供服务之后,您需要确保将服务器配置为捕获任何URL。
但是对于Firebase托管,我不确定该怎么办。
只需将以下规则添加到中的“重写”部分 firebase.json
firebase.json
"rewrites": [ { "source": "/robots.txt", "destination": "/robots.txt" }, { "source": "**", "destination": "/index.html" } ]