카테고리 없음

URL 새로고침 시 404 에러 해결하기

Ahyeon, Jung 2024. 10. 29. 06:28
 

임시

 

 

리액트

BrowserRouter 대신 HashRouter를 사용한다.

Next output: "export"

Next.js를 Static Generation 배포할 때, 빌드된 파일들을 보면 각 페이지가 index.html과 페이지명.html로 구성된 것을 확인할 수 있다. trailingSlash: true를 추가해주면 된다.

/** @type {import('next').NextConfig} */
const nextConfig = { output: "export", exportTrailingSlash: true };

export default nextConfig;

 

next.config.js Options: trailingSlash | Next.js

 

next.config.js Options: trailingSlash | Next.js

Configure Next.js pages to resolve with or without a trailing slash.

nextjs.org