Canonical for dynamic pages in CodeIgniter

In this blog, we will learn how to use canonical for dynamic pages in Codeigniter. Canonical is an important part of SEO, It is used to prevent URL duplicity. It tells the search engine this page has a particular URL.

Let’s see how we use canonical in CodeIgniter, paste this code in the head section of your page:


 <?php
echo '<link rel="canonical" href="' . site_url( $this->uri->uri_string() ) . '" />' ?>  


Example:


<head>
 <?php
echo '<link rel="canonical" href="' . site_url( $this->uri->uri_string() ) . '" />' ?> </head>  


Why should we use canonical in our page?

Duplicate URL or content is very harmful to our website, when search engines crawl our website pages if we don’t use canonical it crawl our single page multiple times and treat it as duplicate. If a search engine finds duplicate content it give a bad impact on our website ranking.

So keep in mind canonical is necessary for making our website search engine friendly.

Categories: web development digital marketing codeigniter

Trending Courses

CodeIgniter

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Advance Digital Marketing

Regular : 6 Months

Fastrack : 3 Months

Crash : 2 Months

React JS

Regular : 45 Days

Fastrack : 20 Days

Crash : 7 Days

Laravel

Regular : 45 Days

Fastrack : 20 Days

Crash : 10 Days

Front End Developer

Regular : 7 Month

Fastrack : 4 Month

Crash : 2 Month

Related Blogs

Request For Demo