URL sanity check and 404 not found handling.