help me about redirect 301

Discussion in 'Site & Server Administration' started by m7shsh, Sep 27, 2008.

  1. #1
    hi

    i delete from my site folder whith 1000 pages

    the folder name example

    http://health.name.com


    i want redirect to

    http://www.name.com/vb


    whith all pages inside the subdomain health folder

    because they show me in google webmaster not found pages :(
     
    m7shsh, Sep 27, 2008 IP
  2. Banglamart

    Banglamart Well-Known Member

    Messages:
    162
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #2
    301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently".

    ColdFusion Redirect
    <.cfheader statuscode="301" statustext="Moved permanently">
    <.cfheader name="Location" value="http://www.eicrasoft.com">


    PHP Redirect
    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.eicrasoft.com" );
    ?>


    ASP Redirect
    <%@ Language=VBScript %>
    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location","http://www.eicrasoft.com/"
    %>


    ASP .NET Redirect
    <script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location","http://www.eicrasoft.com");
    }
    </script>


    JSP (Java) Redirect
    <%
    response.setStatus(301);
    response.setHeader( "Location", "http://www.eicrasoft.com/" );
    response.setHeader( "Connection", "close" );
    %>


    CGI PERL Redirect
    $q = new CGI;
    print $q->redirect("http://www.eicrasoft.com/");


    Ruby on Rails Redirect
    def old_action
    headers["Status"] = "301 Moved Permanently"
    redirect_to "http://www.eicrasoft.com/"
    end


    Redirect Old domain to New domain (htaccess redirect)
    Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
    The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

    Please REPLACE www.newdomain.com in the above code with your actual domain name.

    In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.

    Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
     
    Banglamart, Sep 27, 2008 IP
  3. IEmailer.com

    IEmailer.com Well-Known Member

    Messages:
    1,864
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Here is an example that will redirect the whole folder from: name.com/folder/ --to--> name.com/newfolder/

    redirect 301 /folder/ http://www.name.com/newfolder/
    redirectMatch 301 ^/folder/ http://www.name.com/newfolder/
    redirectMatch 301 ^/folder/$ http://www.name.com/newfolder/
    redirectMatch 301 ^/folder/(.+)$ http://www.name.com/newfolder/xyz/$1

    And here is another one that will redirect the subdomain with/with out the WWW to a new folder:

    RewriteCond %{HTTP_HOST} ^health.name.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.health.name.com$
    RewriteRule ^(.*)$ http://www.name.org/health [L,R=301]

    Hope i was helpful, REP is most appreciated ;)
     
    IEmailer.com, Sep 27, 2008 IP
  4. abercrombie

    abercrombie Peon

    Messages:
    654
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks. i need to help a buddy do a redirect for domain.com/ to domain.com/news so would the correct code be:

    redirect 301 / [url]http://www.domain.com/news/[/url]
    redirectMatch 301 ^/ [url]http://www. domain.com/news/[/url]
    redirectMatch 301 ^/$ [url]http://www. domain.com/news/[/url]
    redirectMatch 301 ^/(.+)$ [url]http://www[/url].domain.com/news/$1
    Code (markup):
     
    abercrombie, Sep 27, 2008 IP
  5. Boston SEO Freelancer

    Boston SEO Freelancer Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: http://www.eicrasoft.com" );
    ?>
     
    Boston SEO Freelancer, Sep 27, 2008 IP