add errorpage and refactor relative config