Welcome Guest, Not a member yet? Register   Sign In
pagination SEO links

Hi guys,
i'm in trouble with SEO and pagination.

i mean

i have a news controller:

controller News action index

where i list all my news so news page base_url() is this one:


when i retrieve data from db and use pagination class i need first of all use as $config['base_url'] = site_url('news/index');


when outputting my pagination links all will link to with www.mysite.com/news/index/$per_page

this is not good first cause for SEO , my pagination first link will link to:

and my top menu links to www.mysite.com/news

hope someone could understand my bad english Tongue

any suggestion to how to do?

If I understand your problem correctly, one way to fix it is the following:

Go to the following folder - application/config

Open up routes.php.

Inside routes.php add the following route:

$routes['news/(:num)'] = "news/index/$1";

This will then make you urls be like:


I have had Google Webmaster Tools warnings "Duplicate title tags" and "Duplicate meta descriptions" so in the process of refining this code:

  // pagination controller
  $data['canonical'] = trim_slashes($this->uri->uri_string());

  // header
  $canonical    = isset($canonical) ? $canonical : base_url();
  $canonical    = str_replace('www.','',$canonical);
  $canonical    = reduce_double_slashes(base_url() .$canonical);

<link rel='canonical' href='<?php echo $canonical;?>' />

well ... i routes my urls and added conditions all over the site

for example


then in my __construct() i always put:

if($this->uri->segment(2) == 'index'){ redirect(base_url(),'',301);}

is for us the better way to remove index actions using always clean urls?

in pagination then i set always $pagination['base_url'] = site_url('news');

what you think about it? Smile

maybe wrong way ... don't know

Theme © iAndrew 2016 - Forum software by © MyBB