Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 \ Page not found when deploying to Netlify #101

Open
zouhir opened this issue Jan 7, 2017 · 15 comments
Open

404 \ Page not found when deploying to Netlify #101

zouhir opened this issue Jan 7, 2017 · 15 comments

Comments

@zouhir
Copy link
Contributor

zouhir commented Jan 7, 2017

I'm not sure if other static site servers / platforms are all like that, but if we deploy this to Netlify we can only navigate from index.html to other pages using Links, once your refresh or type a URL directly in the address bar we'll get 404

In order to get History push state to work we need to add this re-write rule:

/*    /index.html   200

which can be in a file for Netlify in the repo root.

Can we add this directly? as I can see Netlify support is welcome in the Preact repo.

@developit
Copy link
Owner

Sure! Any chance there's a way to define that in the .toml file? If not then a separate does file is fine.

@zouhir
Copy link
Contributor Author

zouhir commented Jan 7, 2017

Unfortunately no. Netlify does in in 1 way only, which is having a _redirects file in the deployed folder eg dist/ but I'll have to update the docs accordingly

@zouhir
Copy link
Contributor Author

zouhir commented Jan 7, 2017

@developit
Copy link
Owner

I think we decided to punt on this for now, right?

@zouhir
Copy link
Contributor Author

zouhir commented Jan 8, 2017

I think it's very good to have and won't harm if people won't need it! if ytou think so too, here's a PR #103

@pensebien
Copy link

I think people need this. I had to go through a lot of pain to get to understand how to use this. It is really helpful especially for situations where you decide to use routers from you js application

@ianskie1234
Copy link

ianskie1234 commented Nov 22, 2017

Can anyone help me with this problem "PAGE NOT FOUND. Looks like you've followed a broken link or entered a URL that doesn't exist on this site." I really don't know what to do. My folder came from hithub and when I'm finish deploying it in netlify, when I view my site, It goes like this.
capture

@developit
Copy link
Owner

You need to configure the fallback HTML page. You can do this by simply copying dist/index.html to dist/200.html and redeploying.

@douchuis
Copy link

actually i have the same problem, anybody can say exactly what i should do. Thanks

@constantinpojoga
Copy link

in my case, for create-react-app:

  • create a _redirects file in public
  • add /* /index.html 200 to that file

@yash-jp
Copy link

yash-jp commented Jan 4, 2020

but how I had the same problem and it solved but could you please explain what is the reason behind it?

@mikesagini
Copy link

i have the same problem please help

@haroldao
Copy link

i have the same problem please help

same :/

@douchuis
Copy link

douchuis commented Jan 22, 2020 via email

@mayank0307
Copy link

in my case, for create-react-app:

  • create a _redirects file in public
  • add /* /index.html 200 to that file

thanks man! it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants