public static function redirect($target, $status_code = 302, $loops = NULL) {
        if(!$loops) {
            $loops = Loops::getCurrentLoops();
        }

        $config   = $loops->getService("config");
        $request  = $loops->getService("request");
        $response = $loops->getService("response");
        $core     = $loops->getService("web_core");

        if($target instanceof ElementInterface) {
            $target = $core->base_url.$target->getPagePath();
        }

        if(!is_string($target)) {
            throw new Exception("Target must be string or implement 'Loops\ElementInterface'.");
        }

        $response->addHeader("Location: ".$target.$request->getQuery());

        return $status_code;
    }