I am currently customising a url redirection script. I have got it working well, but I have 1 problem. In the script I want to add a redirection if it doesn't exist in the database.
Say if home.domain.com exists and redirects to www.domain.com/home and if myhome.domain.com is not in the database I want it to redirect to www.domain.com I have tried using * in the database, but does not work.
Here is the code below:
<?
$remote = getenv("HTTP_HOST");
$fp = fopen("redirect.cfg", "r");
while (!feof($fp)):
$line = fgets($fp,1800);
$line_list = explode("|",$line);
$url = $line_list[0];
$redirect = $line_list[1];
if ($url == $remote):
Header ("Location:$redirect");
$closefp = fclose($fp);
endif;
endwhile;
$closefp = fclose($fp);
?>
Can you please help me on this or point me in a direction would be appreciated.
Thanks,
Chris