! . . Album Hình . . !

Tìm kiếm Những Gì Bạn Thích !

17 tháng 4, 2017

ReactJs Webpack Deploy F5 Not Found Router

Issue: 
- Run project with command `npm run  serve` all router working fine.
- After build with command ` npm run build` and deploy to Apache or Xamp or Wamp, only root "/" router working, other route is not found 404 when Reload page or F5 key press.
Solution:
- Create file .htaccess in the root deploy project(after run build)
- Copy all code below to .htaccess file:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d 
RewriteRule ^ - [L] 
RewriteRule ^ /index.html [L]

- Restart your server, It's Ok.

Không có nhận xét nào:

Hướng dẫn đăng nhận xét của bạn

  • Nếu muốn đăng nhận xét của mình các bạn click vào "Xem và nhận xét ở đây" dưới mỗi bài đăng, sau đó hộp thoại xuất hiện bạn gõ vào những nhận xét của mình. thế là xong! cảm ơn các bạn đã ghé thăm blog của mình !