PHP logo

PHP logo

Yesterday I posted “301 REDIRECTION WITH PHP“, a mini how-to where I explained how to make a permanent redirection with PHP. But, if your case is similar to mine, that code it is not sufficient, and we must make a different redirection for each URL request.

To do that in one file, you must write the following code:

<?php

// Code for redirection
if (isset($_GET['?old_request']))
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.new-location.com/");
}
// End, you must repeat with each redirection

exit();
?>