PHP
  Home arrow PHP arrow Using the Link Rel Canonical Tag
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Using the Link Rel Canonical Tag
By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2009-05-07


    Table of Contents:
  • Using the Link Rel Canonical Tag
  • Theory of Implementation
  • Implementation Steps
  • Implementing a Canonical Version, First Scenario
  • Implementing Canonical Version for a Secure Website

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Using the Link Rel Canonical Tag
    ( Page 1 of 5 )

    The link rel canonical tag lets you solve canonical issues for your URL without having to resort to 301 redirects or other potentially complicated approaches. This article explains how to take advantage of the tag in your PHP-powered web sites.

    Background

    Any website URL is accessible by either its www or non-www version. For example, if you have a website www.somewebsite.com, people can access it in the browser in two ways:

    • By typing your canonical www version of the URL into their browser: http://www.somewebsite.com
    • By typing the non-www version: http://somewebsite.com

    If you have SSL (secure socket layer certificate), there are an additional two ways that users can access your web site:

    • By typing the https www version: https://www.somewebsite.com.
    • By typing the https non-www version: https://somewebsite.com.

    The problem is even trickier if the domain URLs use session IDs, which is very common with e-commerce websites. In addition to helping you with general canonical URL issues, this article will provide solutions for removing session IDs.

    Users may not have problems with canonical issues, but what happens to a search engine bot? If sites link to both canonical and non-canonical versions of your website, search engine bots will index several versions of your domain, resulting in duplicate content.

    Why is this a serious issue? It will cause the loss and weakening of your internal link juice strength. For example, Google Page Rank flows like water in a pipe, so if some of the link juice flows into the non-canonical version of your domain, it is leaking like water in a pipe with holes.

    This is a common problem in search engine optimization and web development. This is a failure on the part of the web development team to create a canonical version of the URL for the site.

    The common approach to solving this uses 301 redirects. Now sometimes 301 redirects are difficult for an ordinary webmaster who loves to copy and paste the source code. Worse, this can be implemented using .htaccess, which is prone to server incompatibility issues.

    The search engine community, particularly Google, Yahoo and MSN, decided to adopt the link rel canonical element as an easy solution to duplicate content problems, including the non-www and www canonical issue.

    <link rel="canonical" href="http://www.yourcanonicalurl.com" />

    This is to be placed in the <head> section of template source code. The objective of this article is to implement this element so that 301 redirection will not be necessary. The scope of this article focuses only on the PHP/Apache website configuration.



     
     
    >>> More PHP Articles          >>> More By Codex-M
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT