Home arrow PHP arrow Page 2 - Using the Link Rel Canonical Tag

Theory of Implementation - PHP

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.

TABLE OF CONTENTS:
  1. Using the Link Rel Canonical Tag
  2. Theory of Implementation
  3. Implementation Steps
  4. Implementing a Canonical Version, First Scenario
  5. Implementing Canonical Version for a Secure Website
By: Codex-M
Rating: starstarstarstarstar / 6
May 07, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

To understand how to implement this, we must illustrate first how 301 redirection is used to solve this type of problem. Consider the example below, which illustrates a typical non-www and www canonical issue:

Googlebot sees a non-www URL during a crawling session ---> http://somewebsite.com/myfile.php ---> if non-www ---> server will do a 301 redirect to the www canonical version ---> http://www.somewebsite.com/myfile.php ---> Googlebot indexes the www version

Therefore, this means that if Googlebot sees any non-www URL, the server will do a 301 redirect so that Googlebot will index the canonical version.

What should happen when we use the link rel canonical element? See the diagram below:

Googlebot sees a non-www URL during a crawling session ----> http://somewebsite.com/myfile.php ----> Google sees the link rel canonical tag in the head section of this file <link rel="canonical" href="http://wwww.somewebsite.com/myfile.php" /> ------> Google indexes the canonical URL provided.

This means that we have to place this tag in the <head> section so that if any non-www URL is being crawled, Googlebot will fetch the canonical www URL.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: