“Vue JS Mode Produksi Refresh Menyebabkan 404 Kesalahan” Kode Jawaban

Vue JS Mode Produksi Refresh Menyebabkan 404 Kesalahan

url:  https://next.router.vuejs.org/api/#history

createRouter({
  history: createWebHashHistory(),
  // other options...
})
Bored Bug

di halaman refresh vue.js Aplikasi kembali 404



I think you are missing that SPA is not server side rendering. At least for the majority. So, when you access /anything your web server won't redirect it to index.html. However, if you click on any vuejs router link, it will work due to the fact that the javascript got in action, but not the server side.

To solve this, use .htaccess and redirect all requests to index.html like so

<ifModule mod_rewrite.c>
    RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</ifModule>
Hope it helps someone!
shafeeque

Jawaban yang mirip dengan “Vue JS Mode Produksi Refresh Menyebabkan 404 Kesalahan”

Pertanyaan yang mirip dengan “Vue JS Mode Produksi Refresh Menyebabkan 404 Kesalahan”

Lebih banyak jawaban terkait untuk “Vue JS Mode Produksi Refresh Menyebabkan 404 Kesalahan” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya