Proper handling of 404 and api prefixes