+ Reply to Thread
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: redirecting...

  1. #1
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    redirecting...

    lets say that there is a site, but half the time you get the page cannot be displayed error.

    i want to redirect to it but if it doesnt work, it redirects to another site. is this possible? and if it is can you tell me how?

  2. #2
    Phil is offline Retired Staff Phil is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    kingston, Ontairo, Canada
    Posts
    3,672

    Re: redirecting...

    Quote Originally Posted by TarinC
    lets say that there is a site, but half the time you get the page cannot be displayed error.

    i want to redirect to it but if it doesnt work, it redirects to another site. is this possible? and if it is can you tell me how?
    You mean redirect by like a .tk?

  3. #3
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: redirecting...

    You could use PHP, ( fsockopen() ), check if the file/site/whatever is up, if it is, just do header('Location: [URL]') to redirect to that site, if it's not, do header('Location: [URL]') to another site..

  4. #4
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: redirecting...

    site1 - The page i will create
    site2 - the page i want to redirect to
    site3 - in case 2 is not up.

    i want to create a page that will redirect to 2. when the site isnt up it will redirect to a 3rd site instead of the 2nd site.

    is there a code to do that?
    Last edited by TarinC; 10-25-2005 at 03:43 PM.

  5. #5
    Jim's Avatar
    Jim
    Jim is offline
    x10Hosting Member Jim is an unknown quantity at this point
    Join Date
    Feb 2005
    Location
    New York
    Posts
    85

    Re: redirecting...

    <?php
    if(fopen("http://site2")){
    echo "<script>window.location='http://site2';</script>";
    } else {
    echo "<script>window.location='http://site3';</script>";
    }
    ?>
    Last edited by Jim; 10-25-2005 at 04:24 PM.

    http://www.j-fx.ws

  6. #6
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: redirecting...

    Quote Originally Posted by Jim
    <?php
    if(fopen("http://site2")){
    echo "<script>window.location='http://site2';</script>";
    } else {
    echo "<script>window.location='http://site3';</script>";
    }
    ?>
    Same thing I said. You should replace the javascript with just an HTTP header, and it will always work whether the vistor has JS disabled or not.

  7. #7
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: redirecting...

    im sorry but im noob!

    You should replace the javascript with just an HTTP header, and it will always work whether the vistor has JS disabled or not.
    i dont get that.

  8. #8
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: redirecting...

    Take a look at http://php.net/header.

    Header() is a function that is used to send raw HTTP headers to the browser/application viewing the page. In this case, the "Location: [URL]" header, which would instantly redirect the browser to the [URL], instead of having the wait for the page to completly load.

  9. #9
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: redirecting...

    Quote Originally Posted by Jim
    <?php
    if(fopen("http://site2")){
    echo "<script>window.location='http://site2';</script>";
    } else {
    echo "<script>window.location='http://site3';</script>";
    }
    ?>
    i did that and i get a error:

    Warning: fopen() expects at least 2 parameters, 1 given
    in "the file" on line 7

    line 7 of the script would be: if(fopen("http://site2")){
    Last edited by TarinC; 10-25-2005 at 09:12 PM.

  10. #10
    oab's Avatar
    oab
    oab is offline
    x10 Lieutenant oab is an unknown quantity at this point
    Join Date
    Apr 2005
    Location
    Olympia, WA
    Posts
    459

    Re: redirecting...

    you have to put whether you want to read or write or somthing i think im to lazy to look it up..
    http://www.teamoab.com

    aim:dknigh73
    msn:d_knight_3@hotmail.com

+ Reply to Thread
Page 1 of 4 123 ... LastLast

Similar Threads

  1. Redirecting?
    By butter_wing in forum Feedback and Suggestions
    Replies: 2
    Last Post: 11-13-2006, 10:14 PM
  2. Page isn't redirecting properly
    By omnirom in forum Free Hosting
    Replies: 8
    Last Post: 07-28-2006, 09:59 PM
  3. redirecting index's
    By swirly in forum Scripts & 3rd Party Apps
    Replies: 5
    Last Post: 03-12-2006, 12:06 AM
  4. Subdomain not redirecting to index.htm
    By nigelwong in forum Free Hosting
    Replies: 2
    Last Post: 11-09-2005, 01:45 PM
  5. Redirecting Problem
    By lostillusions in forum Free Hosting
    Replies: 1
    Last Post: 05-06-2005, 12:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers