301 redirect question...

Discussion in 'Search Engine Optimization' started by pubsit1000, May 29, 2007.

  1. #1
    I want to redirect some of my domains to a main one.

    For some of them I will do 301 to the entire domain.
    But some other have inner pages with PR and backlinks.

    How can I make redirects for those pages to appropriate pages on the main domain and also redirect everything else to the homepage ?

    Thanks.
     
    pubsit1000, May 29, 2007 IP
  2. sadhivm

    sadhivm Guest

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    to avoid a headache go to rentacoder.com and pay about $100 - $200 to get it done

    301 redirects are not something to play with if you do not know what you are doing

    but you will lose any page rank - eventually the page rank should be passed onto the the new url
     
    sadhivm, May 29, 2007 IP
  3. Fold

    Fold Peon

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If your pages are built with PHP:

    
    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.new-url.com" );
    ?> 
    
    PHP:
    Or ASP:

    
    <%
    Response.Status="301 Moved Permanently";
    Response.AddHeader("Location","http://www.new-url.com/");
    %> 
    
    Code (markup):
     
    Fold, May 29, 2007 IP
  4. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #4
    The solution suggested by Fold is doing the job on client site.

    IMO is better doing the job on server side. You need to update your .htaccess file:

    at OLD_domain.com/.htaccess

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^whatever/(.*)$ http://www.NEW_domain.com/$1/ [R=301,L]

    The last line maybe need to be changed depending on your site structure. (.*) and $1 work the same way here as in mod_rewrite, so you can easily change a lot of URLs with one line. The only change with redirects and mod_rewrite is the R=301 (Redirect 301).
    You can find more info on these pages: Apache mod_rewrite, 301 FAQ redirect thread on DP
     
    ajsa52, May 29, 2007 IP