Monday, September 14, 2009

SEO friendly URL redirection

There are couple of things that one should maintain while redirecting urls not to let the site rank fall down on the search ranks.
Lets first learn about some redirects and then we'll see how to implement them on different servers and/or environment.
  • Redirection : In the HTTP protocol used by the World Wide Web, a redirect is a response with a status code beginning with 3 that induces a browser to go to another location. The HTTP standard defines several status codes for redirection:

    • 300 multiple choices (e.g. offer different languages)
    • 301 moved permanently
    • 302 found (e.g. temporary redirect)
    • 303 see other (e.g. for results of cgi-scripts)
    • 307 temporary redirect

  • Dealing the redirection :
    • html:
    HTTP/1.1 301 Moved Permanently
    Content-Type: text/html
    Content-Length: 174

    <p>This page has moved to <a href=""></a>.</p>
    • CF : Put the following code on the Application.cfm/cfc or on the home page
    <cfheader statuscode="301" statustext="Moved Permanently" />
    <cfheader name="location" value=""; />
    <cfabort />
    • Apache server : Put the following lines on the .htaccess file
    Redirect ^oldpage.html [R=301,L]
    • php
References :