Smart 404 handling.