Create a custom 404 page; Page Not Found

I want to be able to have my own customer 404, this could be really useful in finding broken links, collecting data and a great chance to minimise bounce rates and keep customers looking at your site.

I think this would be a really useful addition that’s needed on all sites.

3 Likes

I believe it currently can’t be done. I hope they implement this feature as it would be really helpful.

I think you can accomplish this by combining a router and SiteStructure. I will try.

You’re right Andreas - by creating a custom router, when there’s no actual entry matching your result, you can decide that instead of returning a 404 error, normally as so:

return notFound();

you can return a regular page which shows what the user would expect (say a page you created which is called “my-custom-404-page”):

return ok("my-custom-404-page", data, seoData); 

The drawback which you should think about, is that the http result returned in this case will be 200, so if you’re expecting an actual 404 error in the http response, this method won’t serve your purposes.

But if I return the new redirect using a 301 then? That’s how your old urls matching works right? I could also make a data collection that looks up the incoming addresses and redirects to the right pages. Then I can use urls like mysite.com/newsflash-sale even if that did not exist in my dc I will redirect that request using 301 and look it up. I could add a counter and the refering site so I can easily see how many 404 I get from certain sites and then contact them to update their links.

Coding without limits :slight_smile:

Where you able to accomplich it Andreas?

New feature out:

https://support.wix.com/en/article/customizing-your-404-error-page