Jump to content


Photo

redirect script


  • Please log in to reply
4 replies to this topic

#1 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 21 July 2006 - 04:02 PM

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

<? 
$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);  
?>

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.


#2 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 21 July 2006 - 04:22 PM

Unless your site's hostname is alaskanflyrod.com the script will not execute the header() function and the browser will not be redirected.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#3 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 21 July 2006 - 05:59 PM

my host is arcticsoft.net, how should it look then?

#4 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 21 July 2006 - 07:56 PM

For that you would need to say what it is you're trying to do.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#5 jpratt

jpratt
  • Members
  • PipPipPip
  • Advanced Member
  • 144 posts

Posted 24 July 2006 - 01:50 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users