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

Keep getting 404 Page not found errors #179

Closed
david-meza opened this issue Jan 9, 2016 · 22 comments
Closed

Keep getting 404 Page not found errors #179

david-meza opened this issue Jan 9, 2016 · 22 comments

Comments

@david-meza
Copy link

I've run both the surge command and surge --domain park-jobs.surge.sh commands and they successfully deploy giving me the following message Success! Project is published and running at powerful-news.surge.sh, but when I check the address I get a page not found. What could be the reason for this? I just did it with another of my apps maybe 5 minutes ago and it worked perfectly. I do have a .surgeignore file on both projects adding the bower_components directory that is being ignored in source control. I do not think this is the issue, though. I also have my cache disabled so I don't think it's a CDN caching issue. Thanks for any help with this issue!

@david-meza
Copy link
Author

Solved it! This isn't documented but apparently there must be an index.html page in your root level of your project path for it to work (similar to gh-pages). Mine was inside the /app folder so it wasn't being recognized.

@kennethormandy
Copy link
Collaborator

Hey, sorry about that. Just to be clear, the project would have been published successfully event without the index.html file, so if you went to park-jobs.surge.sh/app/ it would have shown it even without that change you made.

We have it on our list to improve the 404 page when it’s in the root of the project, to make what’s going on more clear. Thanks for opening an issue!

@gaearon
Copy link

gaearon commented Oct 21, 2016

Was just confused by this, glad I found this thread.

@mtt87
Copy link

mtt87 commented Mar 18, 2017

I'm getting this randomly ~ once a week, I'm using create-react-app and I've done this deploy.sh simple script:

npm run build &&
mv build/index.html build/200.html &&
surge -p build/ -d https://mlsmerchants.surge.sh

I've just tried out of curiosity to rename it back mv 200.html index.html but I still get File not Found.

We are about to launch our app in the next weeks and I've bought surge plus for the main website, it's a shame if it randomly stops working with no reason ☹️

@sintaxi
Copy link
Owner

sintaxi commented Mar 19, 2017

@mtt87 we'll get to the bottom of the issue Im sure. Its just one of those bugs thats only showing up in production so its hard to track down the source the problem. As a workaround you can modify the file by adding a space at the end and I believe it will work.

@iamsoughtout
Copy link

I have this same problem. I just got introduced to sh. I finished uploading my files and it showed me a message :
"Success! Project is published and running at etimsoughtout.surge.sh" However, when i visited the site, I met a "page not found" error. I have tried multiple things to fix this to no avail. Kindly advise on what to do.

@webbdm
Copy link

webbdm commented Aug 31, 2017

@iamsoughtout I'm getting this too. Did they ever find a fix?

@sintaxi
Copy link
Owner

sintaxi commented Aug 31, 2017

"Page not Found" usually means you are missing an index.html file in the root of your project. Verify that you deployed the correct directory.

@webbdm
Copy link

webbdm commented Aug 31, 2017

@sintaxi the index is there in the build folder and it's properly linked to the css & js files. But it just says it can't get them, despite being the correct file path. I will mention though that is it a create-react-app project. Not sure if that is causing any problems.

@iamsoughtout
Copy link

@webbdm i never got a solution from them. I sent a mail to a Brock, who works in Surge. He was replying me for a while, then all of a sudden just went AWOL, without helping to solve the problem. @sintaxi, are you the same Brock I was speaking with? I have an index.html file in the root of the project, and I also shared my file directory pathing with Brock which he didnt fault. He requested to see how I was uploading my file and I sent him a snapshot of my NodeJs command line, showing the processes and the final success message.

@sintaxi if you are the same Brock, I am still waiting for your response, pls.

@nolastan
Copy link

nolastan commented Sep 2, 2017

If you're using create-react-app, make sure you're deploying the build folder by updating your project path. Check out this tutorial for deploying create-react-app with surge.

Rather than update the path each time, you can use the command surge --p=/path/to/app/build.

@sintaxi
Copy link
Owner

sintaxi commented Sep 16, 2017

@iamsoughtout appologies, I had thought I got you the information you needed. The problem you appear to be having is your index.html file is named Index.html. If you change that and redeploy your index.html file will load by default.

I think I am going to start to display a default index.html file when one isnt present so that people can see the files they have uploaded. Does that make sense to you all?

@iamsoughtout
Copy link

after changing my file name to index.html, still showing page not found

@sintaxi
Copy link
Owner

sintaxi commented Sep 20, 2017

@iamsoughtout be sure to redeploy after making the changes. Here is whats showing on your project.

screen shot 2017-09-19 at 10 31 43 pm

@erinfox
Copy link

erinfox commented Jun 20, 2018

Happy I found this. Really helped!

@BellamyRibeiro
Copy link

Hey GUys I need Help!!!! URGENT! =( My page shows : No Page Found! (https://bellamyribeiro.github.io/)

Im sorry im a noob at this! however My file structure is : https://github.com/BellamyRibeiro/BellamyRibeiro.github.io

Any help is appreciated =( Thanks in advance!!!

@DylanAttal
Copy link

Thank you for the advice to make sure I have an index.html file in my root directory. Saved me a headache!

@dShap3
Copy link

dShap3 commented Nov 7, 2019

Solved it! This isn't documented but apparently there must be an index.html page in your root level of your project path for it to work (similar to gh-pages). Mine was inside the /app folder so it wasn't being recognized.

Thank you for helping me.

@rahulvyas
Copy link

rahulvyas commented Sep 28, 2020

I am getting same issue I get success when uploading a flutter web build folder. I already have index.html page on root. Still I'am getting 404 error. How do I trace the issue @sintaxi ?

@sintaxi
Copy link
Owner

sintaxi commented Sep 28, 2020

@rahulvyas its difficult to help you with the limited information you have provided. In most cases when people report this issue they simply deployed the wrong directory. You can visit /auto.appcache to see the published files. Please consider opening a new issue (so others don't get emailed) with detailed information (so I can help) if you can't resolve the problem yourself.

@jessamyn27
Copy link

please add the instructions in "getting started" doc on surge.sh that your root file MUST be called "index.html" I was naming mine app.html and it took me days to figure out that this was the issue, delaying my coding challenge for a hiring process! Other than that y'all are awesome. Might be nice to have a "common issues" or such easily accessed for noobs like me :)

@sunshinescience
Copy link

Thanks so much, having the index file in the root directory got it to work!

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