Add a test case for 301 redirect.
Fix a indentation and a if statement condition.