301 Redirect using .htaccess

Discussion in 'Apache' started by skionxb, Oct 27, 2006.

  1. #1
    I am currently redesigning a site for http://www.avocado.org/

    the new site will have new SEO friendly urls. The old site, has over 3,660 pages indexed in google. I want to 301 redirect them to the new pages. Do you think i should do global redirect for all of them at the same time?
    for instance: if someone clicked on the old url it will go to new INDEX (Home page)

    ErrorDocument 404 /index.html

    or

    should I do following for all 3600 pages?

    redirect 301 /old_file1.html http://www.domain.com/new-file1.html
    redirect 301 /old_file2.html http://www.domain.com/new-file2.html
    .
    .
    .
    redirect 301 /old_file3660.html http://www.domain.com/new-file3660.html



    some people recommened to use this

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^shop/(.*)\_(.*)\.html$ http://www.domain.com/$1-$2.html [R=301,L]


    Please do not get me wrong but i still don't get it

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^shop/(.*)\_(.*)\.php$ http://www.avocado.com/$1-$2.php [R=301,L]

    i changed html to php, because www.avocado.org uses php file extentions, not html

    Now $1-$2 what $2 means, i have more then 2 urls to redirect, 3400 total

    Will all of these 3400 old urls will be redirected to the home page of the new site? I won't change the domain name, it will still be www.avocado.org but it will have new URLS

    Please help!
     
    skionxb, Oct 27, 2006 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Since I have the same question I am doing a bit of research and will share what I find. I think this is your second thread or maybe someone else.

    Give me an exact example of how you are changing the names
    Using the example above are you just changing "old-file" to "new-file" ?

    The last time I did this I did individual 301's for all the high ranked pages and a custom 404 with links to every page on the site for the rest of them.
     
    Colbyt, Oct 27, 2006 IP
  3. skionxb

    skionxb Peon

    Messages:
    376
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The last time I did this I did individual 301's for all the high ranked pages and a custom 404 with links to every page on the site for the rest of them.

    I like this idea, how did you do that? Can you show me an example of the code?

    Thanks
     
    skionxb, Oct 27, 2006 IP
  4. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #4
    Colbyt, Oct 27, 2006 IP
  5. anblog

    anblog Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for the javascriptkit.com link. Very useful.
     
    anblog, Oct 31, 2006 IP
  6. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #6
    I only had 30 some pages to deal with. Your task sounds much harder. I went to MSN. Google, Yahoo and made a list of what they had indexed. I just copied and pasted the search results into notepad to edit.

    There were clear boundries indicated between the top 30 pages and the rest. I added a custom error handler to the .htacess file and set permanet links for those 30 pages using cPanel to write them.
    On the 404.html page I explain that we have remodeled and that there is a link to every page of the new site here. In your case I would try to add a site search function to error page.

    Anything you can do to keep them on your site is worth the effort.
     
    Colbyt, Nov 1, 2006 IP