301 or 302? How to set up directory redirects?

Discussion in 'Site & Server Administration' started by MisterZee, Oct 2, 2005.

  1. #1
    I've got a directory and am doing a 301 redirect (not straight link because I need to track links out). Is that the appropriate redirect method? Or is it 302? I did 301 because I heard 302's cause problems but I find the whole thing so confusing that I thought I should double check.
     
    MisterZee, Oct 2, 2005 IP
  2. LikeMike

    LikeMike Peon

    Messages:
    69
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Umm, can anyone explain what the heck a 301 redirect is? I've been hearing that term and a couple days now and it seems like something I should know about. :eek:
     
    LikeMike, Oct 2, 2005 IP
  3. Smyrl

    Smyrl Tomato Republic Staff

    Messages:
    13,740
    Likes Received:
    1,702
    Best Answers:
    78
    Trophy Points:
    510
    #3
    LikeMike a 301 is a permanent redirect while a 302 is a temporary redirect. These are handled on a Linux server through your .htaccess file. Most control panels allow you to automatically set up both type of redirects. If you do not have that capability and have a .htaccess file you can edit it with a text editor. Most .htaccess tutorials show how to set up both type redirects.

    MisterLee, your question is more complicated. Will let someone more knowledgeable than I answer. I believe Google likes 301 redirects and Yahoo 302 redirects but could be wrong.

    Shannon
     
    Smyrl, Oct 2, 2005 IP
  4. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #4
    >> These are handled on a Linux server through your .htaccess file.

    Actually it has nothing to do with Linux and everything to do with running the Apache webserver :)

    MisterZee, what you need to do is not allow bots access to your redirect script. If your script is at mysite.com/jump.php, include a "Disallow /jump.php" line in your robots.txt file. That way none of the SE's robots will ever see the links or follow them and it won't matter what kind of link they are :)
     
    exam, Oct 2, 2005 IP
  5. LikeMike

    LikeMike Peon

    Messages:
    69
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can anyone give me any examples of why a 301 and/or a 302 redirect would be necessary... Sorry for the noobish questions but I get very curious and like to ask a lot of questions when things are new to me. :) I will also do my share of research on Google.
     
    LikeMike, Oct 2, 2005 IP
  6. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #6
    One example of when you would want to do a 301 redirect is if you are renaming or moving a page so that the search engines can easily find the new page when they see the old one is not there.
     
    exam, Oct 2, 2005 IP
  7. LikeMike

    LikeMike Peon

    Messages:
    69
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok, thank you for helping me out!
     
    LikeMike, Oct 2, 2005 IP
    exam likes this.
  8. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Not a problem :)
     
    exam, Oct 2, 2005 IP
  9. MisterZee

    MisterZee Peon

    Messages:
    227
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Good idea. But I may reuse the script in different places and don't want to remember the robots syntax all over the place. Isn't there a meta tag I can add to the initial page to ask it not be indexed? Oh, but if I redirect it then I can't send meta tags can I?
     
    MisterZee, Oct 2, 2005 IP
  10. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I'm not sure that all SEs use it, but you could try adding the rel="nofollow" attribute to the links.
     
    exam, Oct 2, 2005 IP
  11. xponse

    xponse Peon

    Messages:
    93
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    hi

    I want all files of old domain redirect to new domain

    www.olddomain.com/index.php
    www.olddomain.com/1stdir/2nddir/top.php and others file

    also redirect to new domain www.newdomain.com

    I tried to modify through .htaccess but only www.olddomain.com/index.php is going to www.newdomain.com

    but www.olddomain.com/1stdir/2nddir/top.php is not going to newdomian it giving error page not found
     
    xponse, Oct 5, 2005 IP
  12. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #12
    You're on the right track. the .htaccess file is the right place to do that. Search these forums for how to do it.
     
    exam, Oct 6, 2005 IP