src/request.php
public static function redirect($location, $stop_execution=true, $code=null) {
	if (preg_match('{^(http(s)?:)?//}', $location) == false) {
		$base_url  = 'http';
		$base_url .= !empty($_SERVER['HTTPS']) ? 's' : '';
		$base_url .= '://'.$_SERVER['SERVER_NAME'];
		
		if (strpos($location, '/') !== 0) {
			$base_url .= '/';
		}
		
		$location = $base_url.$location;
	}
	
	header('Location: '.$location, $replace=true, $code);
	
	if ($stop_execution == false) {
		return;
	}
	
	exit;
}
public static function redirect($location, $stop_execution=true, $code=null) {
	if (preg_match('{^(http(s)?:)?//}', $location) == false) {
		$base_url  = 'http';
		$base_url .= !empty($_SERVER['HTTPS']) ? 's' : '';
		$base_url .= '://'.$_SERVER['SERVER_NAME'];
		
		if (strpos($location, '/') !== 0) {
			$base_url .= '/';
		}
		
		$location = $base_url.$location;
	}
	
	header('Location: '.$location, $replace=true, $code);
	
	if ($stop_execution == false) {
		return;
	}
	
	exit;
}
public static function redirect ( $ location , $ stop_execution = true , $ code = null ) { if ( preg_match ( '{^(http(s)?:)?//}' , $ location ) == false ) { $ base_url = 'http' ; $ base_url .= ! empty ( $ _SERVER [ 'HTTPS' ] ) ? 's' : '' ; $ base_url .= '://' . $ _SERVER [ 'SERVER_NAME' ] ; if ( strpos ( $ location , '/' ) !== 0 ) { $ base_url .= '/' ; } $ location = $ base_url . $ location ; } header ( 'Location: ' . $ location , $ replace = true , $ code ) ; if ( $ stop_execution == false ) { return ; } exit ; }
redirect a browser session to a new url
also exists flow

@param  string  $location       relative to the host
@param  boolean $stop_execution defaults to true
@param  int     $code           optional, status code instead of default 302
@return void
redirect a browser session to a new url also exists flow