Return to Snippet

Revision: 16513
at October 30, 2009 21:47 by kirik


Updated Code
function redirect($url = './', $permanent=false)
{
	if($permanent)
	{
		header('HTTP/1.1 301 Moved Permanently');
		header('Status: 301 Moved Permanently');
		header('Retry-After: 120');
		header('Location: ' . $url, true, 301);
		header('Connection: Close');
	}
	else
	{
		header('Status: 200'); // For google chrome
		header('Location: ' . $url);
	}
	exit('If your browser does not support automatic redirect, <a href="' . $url . '" title="proceed">click here</a>.');
}

Revision: 16512
at October 30, 2009 21:47 by kirik


Updated Code
function redirect($url='./', $permanent=false)
{
	if($permanent)
	{
		header('HTTP/1.1 301 Moved Permanently');
		header('Status: 301 Moved Permanently');
		header('Retry-After: 120');
		header('Location: ' . $url, true, 301);
		header('Connection: Close');
	}
	else
	{
		header('Status: 200'); // For google chrome
		header('Location: ' . $url);
	}
	exit('If your browser does not support automatic redirect, <a href="' . $url . '" title="proceed">click here</a>.');
}

Revision: 16511
at August 6, 2009 15:12 by kirik


Updated Code
function redirect($url='./', $permanent=false)
{
	if($permanent)
	{
		header('HTTP/1.1 301 Moved Permanently');
		header('Status: 301 Moved Permanently');
		header('Retry-After: 120');
		header('Location: '.$url, true, 301);
		header('Connection: Close');
	}
	else
	{
		header('Location: '.$url);
	}
	exit('If your browser does not support automatic redirect, <a href="'.$url.'" title="proceed">click here.</a>');
}

Revision: 16510
at August 6, 2009 15:10 by kirik


Initial Code
function redirect($url='./', $permanent=false)
{
	if($permanent)
	{
		header('HTTP/1.1 301 Moved Permanently');
		header('Status: 301 Moved Permanently');
		header('Location: '.$url, true, 301);
	}
	else
	{
		header('Location: '.$url);
	}
	exit('If your browser does not support automatic redirect, <a href="'.$url.'" title="proceed">click here.</a>');
}

Initial URL


Initial Description
Just a function for correct redirecting

*UPD1* header added for Google Chrome

Initial Title
Correct redirect to Location

Initial Tags
redirect

Initial Language
PHP