factored out and reused code to get 404 pages opposed to 404 reponses for get requests