alaskafx2021-09-18 16:49:29
alaskafx, 2021-09-18 16:49:29

404 Not Found Vue?

I put a Vue project on the server, a typical SPA, but with VKontakte authorization.
The problem is that when routing outside the application, it comes out:

What does routing outside the application mean?
Это, когда ты вне этого приложения начинаешь заходить на любую страницу.
К примеру, с google.com заходишь сразу же на любую из страниц приложения.

But if routing happens inside the application, for example: / to /login - everything works.
How to decide?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
low molecular macro, 2021-09-18

Vue Router cannot work with external URLs. Use JS

    path: "/google",
    component: Google,
    beforeEnter(to, from, next) {
      window.location.href = "https://google.com/";

Swert, 2021-09-18

create a .htaccess file in the root of the project

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question