본문 바로가기
개발/web

Netlify에서 Vue router

by 유다110 2019. 11. 27.
반응형

vue router를 사용해 /login이라거나 /register 페이지로 리다이렉트 시켰는가...

만약 Netlify를 사용하는 사람이라면, 이걸 배포했을 때 404 페이지가 뜬다.

 

https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file

 

Redirects and rewrites

You can configure redirect and rewrite rules for your Netlify site in two ways: Syntax for the _redirects file In a _redirects file, each redirect rule must be listed on a separate line, with the original path followed by the new path or URL. Any line begi

docs.netlify.com

 

제대로 돌아가게 하기 위해서는 배포 디렉토리 (public이나, 음, public. 난 public이다.)

_redirects 라는 파일을 생성하고 거기에 리다이렉트 옵션을 적어줘야 한다.

 

난 이렇게 적었다.

/*    /index.html   200

 

물론 만약의 상황에 대비한다면 따로 404 페이지를 만들어주는 게 좋다. 그건 각자.

반응형

'개발 > web' 카테고리의 다른 글

재미있는 REST API 파라미터의 종류와 개요  (0) 2019.03.08
HTTP와 HTTPS  (0) 2019.02.13
웹페이지 최적화  (0) 2018.07.16
html/CSS에 쓸만한 사이트 모음  (0) 2016.03.18

댓글