Micro Niche Builder
Closed Thread
Results 1 to 1 of 1

Thread: Common Redirects

  1. #1
    404 Error Not Found... decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher has a reputation beyond repute decipher's Avatar
    Join Date
    Jan 2003
    Posts
    4,298
    Thanks
    131
    Thanked 299 Times in 196 Posts
    Blog Entries
    12

    Post Common Redirects

    I cam accross this Website Redirect information an thought it was a great peice of information to share with everyone here.

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


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


    ASP Redirect
    <%@ Language=VBScript %>
    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location","http://www.new-url.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.new-url.com");
    }
    </script>


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


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


    Ruby on Rails Redirect
    def old_action
    headers["Status"] = "301 Moved Permanently"
    redirect_to "http://www.new-url.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.



    Redirect to www (htaccess redirect)
    Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
    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
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

    Please REPLACE domain.com and www.newdomain.com with your actual domain name.

    Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
    For more great information visit:
    SEO Tools - Search Engine Optimization Tools

    Thanks!
    Micro Niche Builder - Build SEO Friendly Sites that CONVERT LIKE CRAZY for Adsense, Amazon, Clickbank, & CPA Offers!
    SEO Contest - Home of the WORLD FAMOUS Search Engine Optimization Contests. Think you got what it takes?


  2. The Following User Says Thank You to decipher For This Useful Post:

    Pamastr (10-06-2009)


  3. SEO Software

Closed Thread

Similar Threads

  1. The SEO war of redirects: 301 vs 302
    By robertc34 in forum SEO Forum
    Replies: 3
    Last Post: 11-14-2010, 11:15 PM
  2. Common Personal Branding Mistakes
    By Kay in forum Article Repository
    Replies: 0
    Last Post: 09-06-2009, 07:14 PM
  3. Common Mistakes When Using Pay Per Click Advertising
    By Kay in forum Article Repository
    Replies: 0
    Last Post: 08-24-2009, 04:26 PM
  4. Replies: 0
    Last Post: 07-29-2009, 03:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts