Skip to content

My page comes out 404 with routing #36908

Answered by spenserblack
cofla159 asked this question in Pages
Discussion options

You must be logged in to vote

Those nested pages are able to access with buttons(I connected <Link> component for buttons) but not with typing url to the address bar directly.

GitHub pages isn't fully set up to be a single-page app where all URLs use the same index.html.

A way around this is to use hash routing. Instead of a route like foo.github.io/repo/subpage, it is foo.github.io/repo#/subpage. This works because the actual page is still just /repo, so GitHub loads the correct page, but the hash router will recognize #/subpage and render the correct visuals.

Here's some reading:

If you don't want to use a hash router, I believe you can't use GitHub pages, and will ne…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@yoannchaudet
Comment options

@cofla159
Comment options

Answer selected by cofla159
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pages Host a static website, right from your repo Product Feedback
4 participants