Skip to content

Instantly share code, notes, and snippets.

@nishad
Created March 11, 2016 02:01
Show Gist options
  • Select an option

  • Save nishad/e996aac06452684d7242 to your computer and use it in GitHub Desktop.

Select an option

Save nishad/e996aac06452684d7242 to your computer and use it in GitHub Desktop.
Simple PHP Redirect
<?php
function Redirect($url, $permanent = false)
{
if (headers_sent() === false)
{
header('Location: ' . $url, true, ($permanent === true) ? 301 : 302);
}
exit();
}
Redirect('http://www.google.com/', false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment