question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Router catch all? handling 404s.

See original GitHub issue

When routes aren’t found is there a way to define a catch all route "*" in the router?

I want to handle 404 pages for any routes or sub-routes not defined in my application.

So if someone goes to /this/should/404 I can catch it and have the server render a 404 page.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jorgebucarancommented, Feb 24, 2017

@traducer Currently / acts as the wildcard when no other route matches.

If that’s not good enough, we can make / match only / and * match everything when no other route matches.

What do you think?

1reaction
jorgebucarancommented, Mar 4, 2017

@traducer Implemented by defining a route with a key: *. Not properly documented yet I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling 404 pages (catch all routes) with React Router v5
In this post you'll learn how to implement catch all routes for handling 404 pages with React Router v5.
Read more >
How to make a catch all route to handle '404 page not ...
I got my error handling to work by creating an ErrorController that returns the views in this article. I also had to add...
Read more >
Handle 404s
Add a Catch All Route. Now we just need to add this component to our routes to handle our 404s. Find the <Routes>...
Read more >
08 - Handle 404 pages (catch-all routes) with React Router
Check out https://screencasts.alterclass.io/ for more episodes!▻ Learn to build your own production-ready React applications and become a ...
Read more >
How To Properly Serve 404 Errors on SPAs (with SEO ...
How To Properly Serve Up 404s on Single Page Application (SPA) ... for instance React Router supports a catch-all `<Route path="*">` to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found