creativetimofficial / argon-dashboard-react

React version of Argon Dashboard
MIT License
443 stars 738 forks source link

[Feature Request] Define 404 not found page or resource #7

Closed cmutagorama closed 4 years ago

cmutagorama commented 5 years ago

What is your enhancement?

I would like to display 404 NOT FOUND whenever a user visit an undefined route. Currently when you visit localhost:3000/admin/dashboardd you'll see the admin layout however I don't want that behavior in my app. I want to show 404 NOT FOUND and link to go back.

Thanks Argon team

einazare commented 5 years ago

Hello there, @cmutagorama ,

Thank you for your interest in working with our products. This actually does not fall into our code. You can easily find on stack overflow or google "how to redirect to 404 react". This being said, the solution for your issue is to add inside the Admin layout this line of code:

<Redirect from="/admin/" to "/route/to/404/page" />

This means that if you are on the route "/admin", which, on our product renders the Admin layout, but the path after "/admin" is not implemented in your routing architecture/system, then it will be redirected to "/route/to/404/page".

Hope this clears a bit your issue, please leave it open.

Best, Manu

cmutagorama commented 5 years ago

@EINazare Thank you so much! I been struggling with this issue but with your help I've found a solution.