L
L
LegeArtis2019-02-07 18:04:18
Nginx
LegeArtis, 2019-02-07 18:04:18

Refreshing the page gives 404 Not found?

When updating NOT the main page, it gives 404 Not found. That is, the example.com page works fine and update as much as you want, but when you go through internal routes, for example example.com/user1 example.com/user1/info and the like, it is when you go to this page that everything works fine, but if then it update, get a 404 Not found error. The same is on Apache, but it is enough to upload the .htaccess file with the redirect configuration. Here, as I understand it, you also need to add a redirect somewhere, but it doesn’t work. I tried this option but it doesn't work at all

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    rewrite ^(.*)$ /index.html;
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LegeArtis, 2019-02-08
@LegeArtis

I solved the problem by properly configuring this block
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question