Check for permission and fix redirect.