“Vue JS Tryb produkcji odświeżanie błędu 404” Kod odpowiedzi

Vue JS Tryb produkcji odświeżanie błędu 404

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

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

Na stronie odświeżania vue.js Zwróć 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

Odpowiedzi podobne do “Vue JS Tryb produkcji odświeżanie błędu 404”

Pytania podobne do “Vue JS Tryb produkcji odświeżanie błędu 404”

Więcej pokrewnych odpowiedzi na “Vue JS Tryb produkcji odświeżanie błędu 404” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu