SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: redirecting

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    New York, NY
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    redirecting

    i have been using the following code to redirect web pages to other sites:

    PHP Code:
    <?php
     
    header
    ("Location: http://www.sitehere.com");
     
    ?>
    my question is, is this a fool-proof method way of redirecting, seeing as it is somewhat client-side? if not, is there a better way of doing it?

    thanks for your help

    zing
    Better-Barter.com
    Logo store full of unique, professional identities
    perfect for you or your client!

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do you say it's somewhat clientside?
    Aaron Brazell
    Technosailor



  3. #3
    Non-Member coo_t2's Avatar
    Join Date
    Feb 2003
    Location
    Dog Street
    Posts
    1,819
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Sketch
    how do you say it's somewhat clientside?
    Yeah, what you got there is completely server side.

    Whether it's the best way to do it depends on what your needs are.
    But a server side redirect is probably as good, or better as any client side redirect. I'd imagine the header that the server side redirect uses
    would work with a greater number of browsers(maybe all?) than a client side redirect. Anything client side is subject to a greater number of compatibility issues, IMHO.

    If there's any code after that header you should add an "exit();" .

    There's an example here:
    http://us4.php.net/header

    --ed

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the client-side part is the browser interpreting the header
    Sleep is for ze weazzz z...

  5. #5
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I suppose true, but the same could be said about everything going to the browser. Fact is I don't know of any browser that won't respond as planned to the header you need.

    Aaron
    Aaron Brazell
    Technosailor



  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sketch
    Fact is I don't know of any browser that won't respond as planned to the header you need.
    I think that's what zing was asking about

    Quote Originally Posted by zing
    my question is, is this a fool-proof method way of redirecting
    Sleep is for ze weazzz z...

  7. #7
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    New York, NY
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i just remember seeing something in the PHP documentation referring to some old version of internet explorer not recognizing all the headers properly... but it seems like this is the best method anyway...
    thanks!
    Better-Barter.com
    Logo store full of unique, professional identities
    perfect for you or your client!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •