Old Page Redirect to New

Discussion in 'HTML & Website Design' started by John84, Dec 16, 2006.

  1. #1
    Hello,

    If I were to change my pages from thispage.html to thispage.php or this-page.html how would I make sure that the old page will redirect to the new one?
     
    John84, Dec 16, 2006 IP
  2. Bleachwork

    Bleachwork Peon

    Messages:
    31
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are probably several different ways of doing this, but if you have access to your ".htaccess" file then you could add this line in it:

    Redirect /thispage.html http://yoursite.com/thispage.php
    Code (markup):
     
    Bleachwork, Dec 17, 2006 IP
  3. pzn

    pzn Active Member

    Messages:
    575
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    70
    #3
    or on thispage.html you could put
    <meta http-equiv="Refresh" content="4;url=http://www.domain.com/link.html">
    HTML:
    content=4 - this number is how many seconds until it redirects
    url= - url you want to redirect this page to.
     
    pzn, Dec 17, 2006 IP
  4. baddot

    baddot Active Member

    Messages:
    309
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #4
    or you can use this as well

    
    <?
    header(Location : "http://www.yourwebsite.com");
    ?>
    
    PHP:
     
    baddot, Dec 18, 2006 IP
  5. phree_radical

    phree_radical Peon

    Messages:
    563
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you are changing all of them, you'd use something like this in .htaccess:
    Options +FollowSymLinks
    RewriteEngine On
    rewriterule ^(.*)\.html$ $1.php [r=301,nc]
    
    Code (markup):
     
    phree_radical, Dec 18, 2006 IP
  6. Reckless

    Reckless Peon

    Messages:
    127
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i think changing your .htaccess file is the easiest option
     
    Reckless, Dec 18, 2006 IP
  7. John84

    John84 Active Member

    Messages:
    1,288
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    80
    #7
    I have access to the .htaccess file so I will probably use this option. Thanks a bunch folks.
     
    John84, Dec 18, 2006 IP
  8. weknowtheworld

    weknowtheworld Guest

    Messages:
    306
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Or simply use javascript location.href to redirect it...
     
    weknowtheworld, Dec 19, 2006 IP
  9. jaguar-archie2006

    jaguar-archie2006 Banned

    Messages:
    631
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #9
    If you have a plan to have an SEO for your site someday, take off this code. G will penalize this meta refresh
    :)
     
    jaguar-archie2006, Dec 19, 2006 IP
  10. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Quite right. Never use meta redirects in this situation.
     
    mad4, Dec 19, 2006 IP
  11. baddot

    baddot Active Member

    Messages:
    309
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #11
    why you cant use the php header redirect ?
     
    baddot, Dec 20, 2006 IP
  12. bizoppz

    bizoppz Peon

    Messages:
    1,889
    Likes Received:
    49
    Best Answers:
    0
    Trophy Points:
    0
    #12
    for SEO purposes, you are betting off using the 301 redirect within your htaccess file.
     
    bizoppz, Dec 20, 2006 IP
  13. ddwebguru

    ddwebguru Banned

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Hi
    php redirection is much better then any other.
     
    ddwebguru, Dec 20, 2006 IP
  14. phree_radical

    phree_radical Peon

    Messages:
    563
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Using the php redirect in this case, from my point of view, may create more work for both the webmaster and the web server.

    The webmaster would have to enable php scripting for files with the .html extension, causing a performance hit to requests for all files with that extension. The webmaster has to insert the redirect code into all the the files he or she wants to redirect, and the server has to send all html files, regardless, to be preprocessed by php. Ne?
     
    phree_radical, Dec 20, 2006 IP