How to Create a PHP Redirect?


Sometimes you want to hide an affiliate link, sometimes you may want to log each downloads of a file or just redirect the user to a site through your script. This is where PHP redirection comes handy.

The syntax is as follow:


[ad name=”In Post”]
Just replace the URL with the page you want the user to be redirected to. The die() function is to make sure that the script ends execution if the redirection function failed for some reason.

Note: The word “Location” in the script must always start with a capital first letter. Otherwise, some older browsers might now follow the redirection.

If you want more info on PHP’s header function check out the W3School’s reference page.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.