Jump to content

Archived

This topic is now archived and is closed to further replies.

jpratt

redirect script

Recommended Posts

I am new to doing redirects and found a script to try, it looks like this:

[code]<?
$remote = getenv("HTTP_HOST");
$fp = fopen("redirect.txt", "r"); 

while (!feof($fp)):
$line = fgets($fp,1800); 
$line_list = explode("|",$line); 

$url1 = $line_list[0];
$url2 = $line_list[1];
$redirect = $line_list[2];

if ($url1 == $remote or $url2 == $remote):
Header("Location:$redirect");
$closefp = fclose($fp); 
endif;
endwhile;
$closefp = fclose($fp); 
?> [/code]

Also the text file:

alaskanflyrod.com|www.alaskanflyrod.com|akrod/index.php

and the header in the main account index page pointing to the redirect.php page:

<? require("redirect.php");?>

any ideas why this is not working? Thanks for the help.

Share this post


Link to post
Share on other sites
Unless your site's hostname is alaskanflyrod.com the script will not execute the header() function and the browser will not be redirected.

Share this post


Link to post
Share on other sites
If the user types arcticsoft.net they get the main account page under htdocs, if they type alaskanflyrod.com they are redirected to the akrod folder and that site opens up.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.