Fix internal redirect recursion 500 error