Redirect loop now fixed
TODO: Better way of handling other types of requests (like favicon.ico) and refactoring code