Author Topic: Google Canonical  (Read 23514 times)

0 Members and 1 Guest are viewing this topic.

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Google Canonical
« on: July 11, 2011, 05:48:35 PM »
Hello,

I am running 4images on my website, today i checked the Google webmaster section and i have noticed that Google is pointing many pages as duplicate, I am trying to use Google Canonical but i am unable to fix this issue. My website URL structure is as follows.

site.com/stuff/cat-nokia-7710-themes-27.htm
site.com/stuff/cat-nokia-7710-themes-27.htm?page=2
site.com/stuff/cat-nokia-7710-themes-27.htm?page=3

and so on

now I want to add Google Canonical to my first URL i.e. site.com/stuff/cat-nokia-7710-themes-27.htm

How should I do this?

Rembrandt

  • Guest
Re: Google Canonical
« Reply #1 on: July 11, 2011, 06:01:52 PM »
......site.com/stuff/cat-nokia-7710-themes-27.htm
site.com/stuff/cat-nokia-7710-themes-27.htm?page=2
site.com/stuff/cat-nokia-7710-themes-27.htm?page=3
.....
copy the follow row in all  *?page=X  between <head> .....</head>:
Quote

<head>
.
.
<link rel="canonical" href="http://www.site.com/stuff/cat-nokia-7710-themes-27.htm"/>
.

</head>

mfg Andi

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #2 on: July 11, 2011, 06:43:38 PM »
Well, as you know doing manually will take ages as we have categories with 100 pages, so it won't do the trick, is there anything that can be changed i mean something in functions.php?

in my opinion there should be some changes in the following in functions.php

Code: [Select]
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id']),
I am not sure i am right.

need your help.

Rembrandt

  • Guest
Re: Google Canonical
« Reply #3 on: July 11, 2011, 06:53:41 PM »
there is no php file?:  "cat-nokia-7710-themes-27.php"

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #4 on: July 11, 2011, 07:05:10 PM »
No we are using modified .htaccess here is what we have in .htaccess

Code: [Select]
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
#Mod_bmollet : category name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^theme-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}

#Mod_bmollet : This is to make search function work  ( redirect links from search results )
RewriteRule ^theme([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}

RewriteRule ^postcard([a-zA-Z0-9]+)\.htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}

Rembrandt

  • Guest
Re: Google Canonical
« Reply #5 on: July 11, 2011, 07:16:26 PM »
I can not help you....

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #6 on: July 12, 2011, 04:51:10 AM »
can anybody please help me on this? Its v.imp

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #7 on: July 14, 2011, 04:25:19 PM »
is there any solution available?

Offline sathishIPL

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: Google Canonical
« Reply #8 on: July 15, 2011, 11:58:49 AM »
Quote
......site.com/stuff/cat-nokia-7710-themes-27.htm
site.com/stuff/cat-nokia-7710-themes-27.htm?page=2
site.com/stuff/cat-nokia-7710-themes-27.htm?page=3

I hope the above urls with page=2 and page=3 might be from comment pagination?

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #9 on: July 15, 2011, 12:18:15 PM »
Quote
......site.com/stuff/cat-nokia-7710-themes-27.htm
site.com/stuff/cat-nokia-7710-themes-27.htm?page=2
site.com/stuff/cat-nokia-7710-themes-27.htm?page=3

I hope the above urls with page=2 and page=3 might be from comment pagination?


can you please further explain your reply? I am unable to understand/.

Offline sathishIPL

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: Google Canonical
« Reply #10 on: July 15, 2011, 12:29:06 PM »
Quote
site.com/stuff/cat-nokia-7710-themes-27.htm?page=2
site.com/stuff/cat-nokia-7710-themes-27.htm?page=3

I mean how this pages are coming to you .It might come if you click the pagination in the comment system?

by clicking the next page in the comment?


Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #11 on: July 15, 2011, 12:36:53 PM »
I have done it :)  8)
« Last Edit: July 15, 2011, 05:41:03 PM by khansahib »

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: Google Canonical
« Reply #12 on: July 16, 2011, 03:02:51 PM »
I have done it :)  8)

can you pls. let us know your solution and what you have changed in which files? thx!

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Google Canonical
« Reply #13 on: July 16, 2011, 07:35:31 PM »
Here is how its done :).

open index.php file and find

Code: [Select]
include(ROOT_PATH.'includes/page_header.php');
Paste the following just before the above line.

Code: [Select]
if(isset($_GET['page'])) {
        $site_template->register_vars("google_con_url", '<link rel="canonical" href="' . ROOT_PATH . '/' . $_SERVER['REQUEST_URI'] . '" />');
}
else {
        $site_template->register_vars("google_con_url", '');
}


and insert

Code: [Select]
{google_con_url} in header of your template. Make sure its between <head> tags.

« Last Edit: July 16, 2011, 08:02:37 PM by khansahib »

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: Google Canonical
« Reply #14 on: July 16, 2011, 08:00:32 PM »
Hi - thanx

I assume that the code is inserted in the file details.php - right?