Added redirect to prevent unauthorized access to certain pages