Vuepress: [Netlify Deploy] refresh page got 404 error

Created on 16 May 2018  路  10Comments  路  Source: vuejs/vuepress

OS: Mac high sierra
Node.js version: v8.5.0
VuePress version: 0.8.4
Browser: chrome 66.0.3359.139
local install
package manager: yarn

problem:
I enter a page by sidebar link like this
image
It's OK .

But when I use link like https://note.xkcoding.com/notes/Git/git-note.html
I got 404 error, and browser target link missing suffix .html
image

It also appears 404 error when I refresh page

Is this a bug??

Sorry for my poor English..

Most helpful comment

create a file in your vue root directory - netlify.toml
and put this code in the file

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

commit and push to your git repo

All 10 comments

I tried your repo and even build your doc and tested it with a static server, all works for me.

Please check for this redirect at your web server, which wasn't done by VuePress.

image

Similar to #441

emmmm...I deployed by Netlify... I don't know which web server on Netlify

Sorry but I cannot reproduce it, would you please do more investigation by yourself?

If you had any progress or could give any reproduction method, I will reopen it.

@ulivz I found may be caused by this https://www.netlify.com/docs/redirects/#basic-redirects

similar to https://github.com/developit/preact-boilerplate/issues/101

However I don't know how to fix it

@xkcoding this is cause by the Pretty URLs feature of Netlify, and can be turned of in the Asset optimization setting:

Asset optimization setting

https://determined-volhard-204fe8.netlify.com/notes/Git/git-note.html


You may need to re-deploy to fully update setting

Thanks to @iampaul83.

@xkcoding Is it helpful to you?

@iampaul83 It's very helpful, I am deeply grateful !

@ulivz thank you so much !

create a file in your vue root directory - netlify.toml
and put this code in the file

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

commit and push to your git repo

create a file in your vue root directory - netlify.toml
and put this code in the file

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

commit and push to your git repo

This fixed it for me. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kid1412621 picture kid1412621  路  3Comments

ynnelson picture ynnelson  路  3Comments

zeke picture zeke  路  3Comments

alinnert picture alinnert  路  3Comments

sankincn picture sankincn  路  3Comments