function gotoURL($url) { // use an internal redirect for ajax requests (otherwise might not work), but use 302 for normal logins. This ensures that the URL in the address bar is correct. if (WFRequestController::isAjax()) { throw new WFRequestController_InternalRedirectException($url); } else { throw new WFRequestController_RedirectException($url); } }