I wrote a custom 404 page in Angular 4 and want to keep the wrong url that was entered. You can see the behavior on github for example. They display a 404 page for not existing urls. Example:
Currently I configured my router like this:
{ path: '404', ponent: NotFoundComponent },
{ path: '**', redirectTo: '404' }
Any idea how to archive this?
I wrote a custom 404 page in Angular 4 and want to keep the wrong url that was entered. You can see the behavior on github for example. They display a 404 page for not existing urls. Example: https://github./cdkdfjkdjf
Currently I configured my router like this:
{ path: '404', ponent: NotFoundComponent },
{ path: '**', redirectTo: '404' }
Any idea how to archive this?
Share Improve this question edited Aug 30, 2017 at 18:42 Lazar Ljubenović 19.8k10 gold badges58 silver badges95 bronze badges asked Aug 30, 2017 at 17:12 netshark1000netshark1000 7,41311 gold badges65 silver badges122 bronze badges 2- Check this answer: stackoverflow./questions/36260839/… – Sergio Escudero Commented Aug 30, 2017 at 17:23
- Possible duplicate of Angular 2 How to redirect to 404 or other path if the path does not exist – Kyle Krzeski Commented Aug 30, 2017 at 18:36
1 Answer
Reset to default 12The solution is very simple:
{ path: '**', ponent: NotFoundComponent }