react-route-dom을 사용하는 경우 페이지 새로 고침이나 주소를 직접 입력하는 경우 404페이지가 나타난다.
이를 해결하기 위해 아래 내용을 참고한다.
Step 1 : Create your appnpm install -g create-react-app
create-react-app my-app
Step 2 : Build it for production
cd my-app
npm run build
Step 3 : deploy
- copy and paste everything in build folder to your server
- create a “.htaccess” file and add this snippet :
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
That’s all ! Enjoy it!
https://gist.github.com/ywwwtseng/63c36ccb58a25a09f7096bbb602ac1de
'프로그래밍 > javascript' 카테고리의 다른 글
트리메뉴 라이브러리 비교 (0) | 2020.08.15 |
---|---|
vscode 사용시 jsx에서 emmet 지원설정 (0) | 2020.03.18 |