Back-End/Firebase

[Firebase Hosting] Page Not Found. This file does not exist and there was no index.html found in the current directory or 404.html in the root directory. 오류

koh1018 2022. 3. 29. 23:19
반응형

위와 같은 오류이다.

필자는 파이어베이스 호스팅한 주소로 들어갔을 때 메인 페이지를 제외한 나머지 페이지에서 새로고침을 하면 위 오류 문구가 나왔다.

 

먼저 firebase.json파일에 "public"의 값을 확인해 보았다.

정확히 "build"라고 적혀있었고 build폴더에 index.html 파일도 있었다.

때문에 다른 이유라고 생각했다.

 

여러 방법을 사용해보았는데 아래 방법으로 해결하였다.

 

firebase.json 파일에 아래 코드를 추가하면 된다.

"rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
]

 

위 방법으로 문제를 해결했다.

 

 

출처 : https://stackoverflow.com/questions/28247450/firebase-deploy-404-cant-find-index-html

반응형