Saturday, December 8, 2012

PHP Redirects - Lesson 5


Redirects using PHP HEADER

 

       You can use PHP to create redirects to other pages or websites. This is quite useful if you do any kind of affiliate marketing and hate the ugly links provided - use the Header command to clean ‘em up!

 

<?php

header (“Location: http://linktoredirect.com”);

?>

When a viewer visits this PHP page in their browser, they will be redirected to the link reflected in the “Location” part of the code. This is a good method to use, since other redirect methods using HTML and Javascript can easily be blocked. Header can be used for other functions, but this is one of the more common uses, so we’ll leave it at that for now.
 

No comments:

Post a Comment