Skip to content

How to set up a 404 page when hosted on GitHub Pages is incorrect #49128

@JMHeartley

Description

@JMHeartley

Describe the problem that you experienced

When going directly to a URL listed in the routes array, I received a 404 error on GitHub

Enter the URL of the topic with the problem

No response

Describe what you were looking for in the documentation

My angular app was going to GitHub’s 404 error if I went to a route listed in the routes array or refreshed the browser on any page besides the homepage. The docs did explain why this happens but the solution it provides is wrong.

Describe the actions that led you to experience the problem

I copied index.html and renamed it 404.html and added an empty .nojekyll file but 404 errors now went to a blank page. I followed instructions here and it worked, caching the request route, sending you to the homepage, then going to the cached route from within the app: https://shermandigital.com/blog/fix-404-errors-from-angular-projects-hosted-on-github-pages/

Describe what you want to experience that would fix the problem

No response

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here

No response

If the problem is browser-specific, please specify the device, OS, browser, and version

No response

Provide any additional information here in as much as detail as you can

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: docsRelated to the documentationgood first issueAn issue that is suitable for first-time contributors; often a documentation issue.help wantedAn issue that is suitable for a community contributor (based on its complexity/scope).

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions