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

[eluser]Ngulo[/eluser]
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:

www.mysite.com/news

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

then

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:
www.mysite.com/news/index

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

hope someone could understand my bad english Tongue

any suggestion to how to do?
#2

[eluser]darrentaytay[/eluser]
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:

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

This will then make you urls be like:

http://www.yoursite.com/news/{per_page}
#3

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

//
Code:
<?php
  
  // 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;?>' />
 
 
 
#4

[eluser]Ngulo[/eluser]
well ... i routes my urls and added conditions all over the site

for example

$route['news/:num']="news";

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