Assert that URLS are correct before routing and handle 404 errors