302 redirect on same domain

Discussion in 'Google' started by MaverickConcepts, Sep 8, 2006.

  1. #1
    How does a 302 redirect affect ranking/indexing on the same domain?

    For instance:

    http://www.domain.com/dir1/

    302 redirects to:

    http://www.domain.com/dir1/index.html

    And links are pointing to the index.html
    and may be pointing to the directory url.

    I've seen articles discussing 302 redirects
    across domains (aka 302 hijacking or moving
    websites). But, as anyone had any experience
    with it on the same domain?

    Regards,
    Maverick
     
    MaverickConcepts, Sep 8, 2006 IP
  2. Monty

    Monty Peon

    Messages:
    1,363
    Likes Received:
    132
    Best Answers:
    0
    Trophy Points:
    0
    #2
    302 redirect is supposed to be temporary.

    If the redirection is not temporary, you'd better to use a 301 redirect. Cleaner for engines.
     
    Monty, Sep 8, 2006 IP
  3. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #3
    I lost some indexed pages because I did not understand 301=permanent and 302=temporary.

    The SE according to what I have read always prefer a 301 and treat a 302 with suspicion.
     
    Colbyt, Sep 8, 2006 IP
  4. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As far as I can see you are trying to redirect a directory to itself, just changing the filename, perhaps actually reading index.php

    In which case it's enough add this to your .htaccess file:

    
    DirectoryIndex index.html index.php 
    
    Code (markup):
     
    Pat Gael, Sep 8, 2006 IP
  5. MaverickConcepts

    MaverickConcepts Peon

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi BasedSolutions,

    Thanks for the idea.
    The system 302 redirects a directory
    call, such as http://www.domain.com/dir/
    to
    http://www.domain.com/dir/index.html

    So, your saying to use this on top? or instead of?
    Not sure if the redirect can be disabled, but it
    may be possible to use something a 301.

    Let me know which way you mean.

    Thanks again.
     
    MaverickConcepts, Sep 8, 2006 IP
  6. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi Maverick, I meant use DirectoryIndex instead of mod_rewrite.

    You can try any of these methods, but making sure you are only using one of them in your .htaccess file

    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www.domain.com/dir$ [OR]
    RewriteCond %{HTTP_HOST} ^domain.com/dir$
    RewriteRule ^(.*)$ http://www.domain.com/dir/index.html [R=301,L]
    
    Code (markup):
    DirectoryIndex index.html index.php
    Code (markup):
    or
     
    Redirect permanent /www.domain.com/dir/ http://www.domain.com/dir/index.html
    
    Code (markup):
    change permanent for temporal if that is the case, or [R=301,L] for [R=302,L] respectively in mod_rewrite
     
    Pat Gael, Sep 8, 2006 IP
  7. MaverickConcepts

    MaverickConcepts Peon

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks.

    So, am I correct in assuming that the first one looks out
    for (with the RewriteCond) the url directory string, with
    or without the www., and then the rule tells what to rewrite
    if those RewriteCond's are matched? And the DirectoryIndex doesn't
    do any redirects at all?

    Now, this is what happended in the rankings and indexing for the url.

    I only had linking to http://www.domain.com/dir/index.html,
    with the http://www.domain.com/dir/ redirect to the index.html
    page active. If I put http://www.domain.com/dir/index.html
    in google, it showed up. Then when it was ranking, it was top
    1000, then got into the top 200. Then it dropped out of the top
    1000. When I then went to see it was indexed,
    http://www.domain.com/dir/index.html didn't show up in google.
    However, if I do www.domain.com/dir/index.html or www.domain.com/dir/
    or any substantial piece of the string, it shows up! And the cache
    is up to date!

    So, with all that, wondering if this caused by the redirect? Thoughts?

    And thanks again for your help.
     
    MaverickConcepts, Sep 9, 2006 IP