X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FSystem.php;h=42587577dae573105a9f6ce462a0556fb7d8d5d2;hb=fa1f48e1711c64d42ddb0f72c7670fa28f56482d;hp=e2966a9b0e8df7d69b96fb765a76da40503aad19;hpb=c9cce8492e5b2607b2a092474d1de4d188b7a2c9;p=friendica.git diff --git a/src/Core/System.php b/src/Core/System.php index e2966a9b0e..42587577da 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -223,15 +223,30 @@ class System extends BaseObject * Redirects to an external URL (fully qualified URL) * If you want to route relative to the current Friendica base, use App->internalRedirect() * - * @param string $url The new Location to redirect + * @param string $url The new Location to redirect + * @param int $code The redirection code, which is used (Default is 302) + * * @throws InternalServerErrorException If the URL is not fully qualified */ - public static function externalRedirect($url) + public static function externalRedirect($url, $code = 302) { if (empty(parse_url($url, PHP_URL_SCHEME))) { throw new InternalServerErrorException("'$url' is not a fully qualified URL, please use App->internalRedirect() instead"); } + switch ($code) { + case 302: + // this is the default code for a REDIRECT + // We don't need a extra header here + break; + case 301: + header('HTTP/1.1 301 Moved Permanently'); + break; + case 307: + header('HTTP/1.1 307 Temporary Redirect'); + break; + } + header("Location: $url"); exit(); }