Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jun 2006
    Location
    Nottinghamshire
    Posts
    184
    Tokens
    0

    Default V.Simple PHP Redirection Tut.

    Ok, if you dont hav e cPanel and can't take advantage of the really simple Redirection thing, then you'll need the following php code. For example if you wanted your site (http://www.example.com) to redirect to (http://www.example.com/forums) then you'll need to create a new document in the public_html directory called 'index.php' and add the following code.

    <?PHP
    header("Location: http://www.example.com/forums");
    ?>
    If you would like to add a delay in the redirect then add the following code.
    <?php
    header("Refresh: 5; URL=http://www.example.com/forums");
    ?>
    Replace 5 with the amount of second you wish for the delay.

    That's it.

  2. #2
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    urmm im not a 100% but your second code looks like a meta refresh in php header tags "/ wouldnt that just cause an error message "/

  3. #3
    Join Date
    Jun 2006
    Location
    Nottinghamshire
    Posts
    184
    Tokens
    0

    Default

    I wouldn't post it without testing it. I've used it quite frequently in my Dad's sites as he bought one without cPanel once.

  4. #4
    Join Date
    Dec 2005
    Location
    Australia
    Posts
    550
    Tokens
    0

    Default

    Looks good.

  5. #5
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:

    Default

    Yeah thanks, but most of us have cPanel and can redirect.

  6. #6
    Join Date
    Apr 2006
    Location
    wolvo init lol.
    Posts
    2,272
    Tokens
    0

    Latest Awards:

    Default

    Exactly. MOST of us. There might be a few people who dont still

  7. #7
    Join Date
    Jun 2006
    Location
    Nottinghamshire
    Posts
    184
    Tokens
    0

    Default

    I know, I have cPanel. Most people do have cPanel. Some dont. Also, on cPanel you can put a delay. You might have changed your site name and when you go onto the old site it says.

    Just a quick not to say, ou name has changed to 'soandso' at the domain 'http://www.soandso.com'. Soon, this domain will be out of use, so please get into the habbit of using the new domain.
    And have a delay of 15 seconds whilst the user reads the message then it automatically redirects them.

  8. #8
    Join Date
    Apr 2006
    Location
    wolvo init lol.
    Posts
    2,272
    Tokens
    0

    Latest Awards:

    Default

    Well put

  9. #9
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    Never knew the refresh: bit, thanks.

  10. #10
    Join Date
    Apr 2006
    Location
    wolvo init lol.
    Posts
    2,272
    Tokens
    0

    Latest Awards:

    Default

    Ill use that in future if needed - thanks.

Page 1 of 2 12 LastLast

Posting Permissions

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