When user navigates to a product that no longer exists, or enters bad url, router resolves PageNotFoundModule
This is the important part in AppRoutingModule
{
path: 'page-not-found', loadChildren: './modules/page-not-found/page-not-found.module#PageNotFoundModule'},
{
path: '**', redirectTo: 'page-not-found'
}
Everything works great, except that user cant go Back! When she clicks BACK button she gets redirected back to the page that triggered 404 in the first place, and immediately gets redirected back to 404 page all over again.
I am aware there is a solution for this when i manually navigate to certain page
this.router.navigate(["some-url/22"], {replaceUrl:true});
But this is useless for me (at least without refactoring a lot of my code to manually detect broken pages and redirect to page-not-found myself)