Redirect to login page only if request format is not JSON