replace hard links by url_for
throw error 404 instead of error 500 when resource or page does not exist + rewrite tests