,

PHP – Simple Function for URL Redirection

Redirecting to another URL in PHP requires passing the Location header and exiting thereafter:



Though this method does work, I find it rather unclean. So, I prefer specifying the HTTP status code and also returning HTML/JavaScript for redirection. The HTML can be quite using when the page client is on a connection with very limited bandwidth.


  
  
  
  
  
  

Redirection in progress...


If the redirect fails just visit the following URL: $destination.
EOD; echo $html; exit; } ?>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *