Redirect using PHP
Redirecting using PHP is very simple. You just need a single line of code in your php page. I’ll split it out to two lines in the example below for the sake of clarity. Create a text file, calling it redirect.php. Add the following content to it:
<?php
$URI = $_REQUEST['to'];
Header ("Location: $URI");
?>
In the above example, we use the ‘to‘ parameter to specify our target URI.
To use this in your pages your link would look like the following:
<a href="http://www.example.com/redirect.php?to=http://www.vftw.com">Visit vftw.com</a>
You’d obviously replace example.com with your own domain, or you can omit it if you are referring it from the same domain.
Make sure there are no spaces or line-breaks before the <?php. If you are modifying the HTTP header, you are not allowed to write the the stream before that line.
Get Email updates










