src/Beluga/Web/Http/Header.php
public static function SendLocation( string $path, string $host = null, bool $exitHere = true )
   {

      if ( empty( $host ) || ! \is_string( $host ) )
      {
         if ( ! isset( $_SERVER[ 'HTTP_HOST' ] ) )
         {
            exit( 'Could not send a Location header if no host is defined!' );
         }
         $host = $_SERVER[ 'HTTP_HOST' ];
      }

      \header( 'Location: http://' . $host . '/' . \ltrim( $path, '/' ) );

      if ( $exitHere )
      {
         exit;
      }

   }
public static function SendLocation( string $path, string $host = null, bool $exitHere = true )
   {

      if ( empty( $host ) || ! \is_string( $host ) )
      {
         if ( ! isset( $_SERVER[ 'HTTP_HOST' ] ) )
         {
            exit( 'Could not send a Location header if no host is defined!' );
         }
         $host = $_SERVER[ 'HTTP_HOST' ];
      }

      \header( 'Location: http://' . $host . '/' . \ltrim( $path, '/' ) );

      if ( $exitHere )
      {
         exit;
      }

   }
public static function SendLocation ( string $ path , string $ host = null , bool $ exitHere = true ) { if ( empty ( $ host ) || ! \ is_string ( $ host ) ) { if ( ! isset ( $ _SERVER [ 'HTTP_HOST' ] ) ) { exit ( 'Could not send a Location header if no host is defined!' ) ; } $ host = $ _SERVER [ 'HTTP_HOST' ] ; } \ header ( 'Location: http://' . $ host . '/' . \ ltrim ( $ path , '/' ) ) ; if ( $ exitHere ) { exit ; } }
Sends a valid HTTP Location header for doing a redirect.

If you dont want to send some other HTTP headers after this header, DONT CHANGE the $exitHere parameter
to FALSE.

@param string  $path        e.g.: /test/probe.php (Must be a absolute URL path!)
@param string  $host        Optional host definition. If not defined here, $_SERVER[ 'HTTP_HOST' ] is used.
@param boolean $exitHere    Exit after sending the header? (default=true)
Sends a valid HTTP Location header for doing a redirect .