[TIL 220112] next.config.js rewrites()

Ko Seoyoung·2022년 1월 12일
0

✅ Today I Learned

목록 보기
13/16

next.config.js rewrites()

페이지 요청이 들어온 path를 다른 path로 매핑시켜준다.

/blog 페이지를 홈 경로인 / 로 설정하고 싶다면 next.config.js 파일에 아래와 같이 설정해주면 된다.

module.exports = {
  async rewrites() {
    return [
      {
        source: '/blog',
        destination: '/',
      },
    ]
  },
}

Refs

https://nextjs.org/docs/api-reference/next.config.js/rewrites

profile
Web Frontend Developer 👩🏻‍💻 #React #Nextjs #ApolloClient

0개의 댓글