Home Joomla Canonical URL Module
Joomla: Canonical URL Module
Written by Andreas Berger   
Friday, 13 February 2009 22:55

 

The bretteleben.de "Canonical URL" Module for Joomla 1.5 allows to set selective the - supported by Google from this month on - "Canonical URLs" in the HEAD of single Pages. This helps to prevent being punished for delivering DuplicateContent and to concentrate PageRank to the main URL, if a page can be reached from different URLs.

bretteleben.de "Canonical URL" Module for Joomla 1.5

The bretteleben.de Canonical URL Module works with Joomla 1.5.

The module offers 10 pairs of parameters to modify the real URL and use the result to set the TAGs <link rel="canonical" href="/desired link">. Starting with version 1.1 it is possible to run multiple instances of the module against a page. They are executed in the order they are set in the backend.

New in Version 1.1:

- possibility to run multiple instances against one page

Features:

- replace single parts of the path
- remove unwanted GET-parameters
- set a fixed URL
- run multiple instances against one page

Installation and Usage

1.) Upload and install the Package.
2.) Activate the module for all or selected Menu-Items.
3.) Parameters:
There are 10 pairs of parameters available.
Each pair consists of the text to search (1th part) and the text to replace with (2nd part).

Sample1: You use Joomfish but don't have translated all of your pages. To prevent getting punished for delivering DuplicateContent, you set the canonical URL of - not translated - pages to URL of the the main language.

Rule01: Find part of URL: lang-de (still delivers english content)
Rule01: Set part of URL: lang-en (this is your main language, we use it as canonical url)

Using this rule for pages - still delivered in english but reached in the section /lang-de/ - sets the canonical URL for this pages to /lang-de/ and prevents DuplicateContent.


Sample2: You use (as I do) yvComment, but don't want to get the pages with the request-parameters (start=10, 20, and so on) to get indexed to concentrate PageRank to the "main"-pages.

Rule02: Find part of URL: start=
Rule02: Set part of URL:

The text in the first part of this rule ends with an equal sign. This tells the module, that we want to modify a request-parameter. The module now replaces not only "start=" but includes the values (0,10,20,30,...) too. The whole parameter is replaced with the text given in the second part of the rule, in this sample: nothing, i.e. the whole parameter is removed from the URL.
Notice: You must not include ? or & (resp. & amp;). These are handled by the module automatically.


Sample3: You want to set for a special page a fixed canonical URL to be used for indexing the page, whatever parameters the page is called with.

Rule03: Find part of URL:
Rule03: Set part of URL: /my-desired-canonical-url.html

In this case the first part of the rule stays empty, this way telling the module that the complete (relative) URL is to replace.


The module works down the rules one by one and inserts the resulting URL as rel="canonical" URL into the head of your page(s).

The domain-part of the URL is NOT modified. This should be done by using redirects.

Limitations:

Bug-reports, Feature-Requests, Hints are highly welcome.

Please handle with care, because wrong settings (unreachable) may cause pages from dissapear from the Google-Index completely! Check every set rule within the source of the concerned page(s)!!!
The module is NO replacement for Joomlas SEF-plugin or an external SEF-extensions! It is only a supplementation!

A step by step tutorial will follow.

Demo

The module is used to set a canonical URL for the menu item Very Simple Image Gallery and removes the yvComment-parametrs, even when browsing the comments.

Compatibility

The module is tested successful with Joomla 1.5.6, 1.5.7 and 1.5.8. Anyway, using it aside with one or another existing plugin/modul/component may bring to light problems i haven't foreseen.
Again I suggest a test run before using it on a live site and stand by for your questions and suggestions.

License

The module is licensed under the GNU Public License (www.gnu.org/copyleft/gpl.html).

update Version: 1.1.0

Version 1.1.0 - 2009-03-29

- check if a canonical URL is already set by another instance and work with it

Version 1.0.0 - 2009-02-13

Support

If you have questions or suggestions, please use the comment-function. Records about the behavior of this extension (positive or negative) are most welcome.

If you use this extensions, you have the possibility to post a rating and a review at joomlaos.de or extensions.joomla.org. Furthermore I appreciate everyone, supporting me with a link back to www.bretteleben.de on his/her website. The extension itself does not produce any hidden links, eastereggs or whatever.

Download

The ZIP-archives contain the module, by downloading it you agree to the terms of the GNU Public License. The ZIP-Archive can be used for both, upgrade and fresh installation.

Downloads:
FileLast Modified
Download this file (mod_canonical_1.1.0.zip) mod_canonical_1.1.0.zip2009-03-29
Last Updated on Wednesday, 13 January 2010 09:10
 
Comments (29)
Canonical cross-domain
29 Wednesday, 27 April 2011 09:42
timo

Hallo,

Ich habe das Problem dass meine Seite über zwei Domains abrufbar ist und ich möchte eine als Standard definieren. Soweit ich weiß funktioniert das rel = canonical auch cross Domains. Lässt sich dass mit Deinem Modul abbilden?


Danke!!

@timo
Wednesday, 27 April 2011 20:52
A. Berger

Hallo timo!

Dafür ist dieses Modul eigentlich nicht gedacht. Ich würde das eher über einen echten 301-redirect am DNS einer der Domains oder zur Not noch über die .htaccess Datei lösen. Alles Andere ist meiner Ansicht nach Stückwerk und auf Dauer nicht zielführend.

Gruß
Andreas

Alles klar!
28 Thursday, 17 March 2011 09:44
Thomas

Hallo Andreas,

danke für die Info. Ich dachte, dass das Tool auch eine von außen erkennbare Umleitung bewirken würde, aber die braucht man dann ja gar nicht. Vielen Dank nochmal!

Herzliche Grüße
Thomas

@Thomas
Monday, 04 April 2011 19:55
A. Berger

Hallo Thomas!

Naja, theoretisch lassen sich die ganzen Parameter schon mit einzelnen Regeln erfassen, aber es ist ziemlich mühsam.
Wenn Deine Seite eine Zeitlang ohne SEF-URLs online war und dementsprechend viele Varianten herumgeistern, dann bist Du vermutlich mit der Erweiterung "Redirect for Joomla!1.5" am besten beraten (extensions.joomla.org/extensions/site-management/url-redirection/14676).
Das ist ein Backport der - in Joomla!1.6 im Core enthaltenen - Komponente, die es Dir erlaubt, URLs umzuleiten. Damit kannst Du die nicht-SEF URLs als kompletten String eingeben und als Ziel die entsprechende SEF-Url angeben.
Das ist ein anderer Ansatz als die Canonical URL, aber in diesem Fall ist es sicher der bessere Weg um die nicht-SEF URLs langfristig komplett wegzubekommen.

Gruß
Andreas

Noch vieleDC-Varianten
Monday, 04 April 2011 08:10
Thomas

Hallo Andreas,

ich bins nochmal. Mit der site-Abfrage bei Google site:www(dot)english-for-children(dot)com habe ich festgestellt, dass da noch etliche Varianten herumschwirren:
"index.php?option=com_content&view=frontpage&Itemid=1〈=de" und "www.english-for-children.com/?option=com_content&view=article&id=4&Itemid=3"

Ich habe versucht, das mit
index.php?option=
und
/?option=
auf ein leeres Feld umzuleiten, aber da passiert nichts. Hast Du eine Idee?

Gruß
Thomas

HomePage
27 Wednesday, 16 March 2011 12:42
Elad

Greetings!

First of all, I would like to thank you very much for this great module.
Easy to use and effective, BRAVO!
The one thing that bothers me is that all of the examples and comments refer to the suffix of the URLs, but what about the PREFIX?
I mean, how do you turn http://mysite.com to http://www.mysite.com?

Thanks!

@Elad
Wednesday, 16 March 2011 21:39
A. Berger

Hi Elad!

Changing the Sub-Domain is - intentionally - out of the scope of this module. To prevent duplicate content because your content is available through domain.com AND the sub-domain www.domain.com please use a permanent redirect (301) in your .htaccess-file (search Google for "redirect 301 htaccess") and - in addition - I would create an account at Google Webmaster Tools (http://www.google.com/webmasters/tools/), verify the domain and use "Site Configuration" > "Settings" > "General Settings" > "Preferred Domain" to specify if you want Google to index your pages with or without the subdomain "www". This works fine for me.

Best regards
Andreas

Nichts passiert
26 Tuesday, 15 March 2011 12:04
Thomas

Hallo Andreas,

ich versuche auf www(dot)english-for-children(dot)com mit Deinem Tool cannonical urls zu erstellen. Bisher folgende Einstellungen:

Rule01: Find part of URL start.html
Rule01: Set part of URL
Rule02: Find part of URL  en
Rule02: Set part of URL  de

Leider passiert rein gar nichts. Bitte um Hilfe. Danke
Thomas

@Thomas
Wednesday, 16 March 2011 21:46
A. Berger

Hallo Thomas!

Also soweit ich das sehe, funktioniert das Modul einwandfrei. Im Quelltext der Seite http://www.english-for-children.com/en/start.html findet sich der TAG rel=canonical und als canonical URL ist "http://www.english-for-children.com/de/" gesetzt.
Es werden also beide Regeln korrekt angewendet. "start.html" wird entfernt und "en" wird durch "de" ersetzt.

Gruß
Andreas

Passiert leider immer noch nix
Wednesday, 16 March 2011 10:02
Thomas

Hallo Andreas,
danke für die Antwort.

a) das Modul ist aktiviert
b) mit Seiten ausgewählt meinst Du den Punkt "Menüzuweisung"?! Dort habe ich "alle Menüs" ausgewählt.
c) Bei den Modulpositionen hatte ich tatsächlich eine nicht existierende ausgewählt. Aber auch wenn ich das ändere, passiert nicht wirklich was.

Fazit: Es klappt noch nicht so wie es soll. Bitte nochmals um Hilfe. Danke

Thomas

@Thomas
Tuesday, 15 March 2011 21:03
A. Berger

Hallo Thomas!

Hast Du das Modul (a) aktiviert und (b) die Seiten, auf denen es angewendet werden soll in den Einstellungen des Moduls ausgewählt und ist - zu guter Letzt - (c) die Modulposition, der Du das Modul zugewiesen hast, in Deinem Template auch vorhanden?

Gruß
Andreas

canonical tag
25 Friday, 25 February 2011 01:20
Andriy

Mein vorhaben:

auf: http://www.burnfree.info/burnfree.html

canonical tag ersheinen lassen mit: canonical  http://www.burnfree.info

da gleiches Content (Startseite die durch Zwei Knöpfe erreicht werden kann einmall durch "burnfre" im Menü links und das andere mal über "burnfree" im Menü oben)

Meine Eingabe im Canonical Module:
Rule01: Find part of URL    http://burnfree.info/burnfree.html
Rule01: Set part of URL     http://www.burnfree.info

der Canonical Tag der danach creiert wird ist: href="http://www.burnfree.info/burnfree.html" rel="canonical" />
was mache ich falsch?

danke, Grüsse aus Hannover. Andriy.

Es funktioniert, danke !
Tuesday, 15 March 2011 15:39
Andriy

Vielen Dank , Andreas.

Ich hab es so eingestellt wie Du empfohlen hast.
Jetz funktioniert es !
Auf der seite http://www.burnfree.info/burnfree-info.html
( die in Wirklichkeit absolut gleiches Content hat, wie http://www.burnfree.info ) taucht jetz:

link  href = "http:/www.burnfree.info/" rel="canonical"

Toll :)   !

Danke schön,
Andriy.

@Andriy
Sunday, 27 February 2011 20:01
A. Berger

Hallo Andriy!

Das Modul kümmert sich nicht um die Domain (dafür nutze bitet die .htaccess) sondern um Alles was danach kommt. "http://burnfree.info" sieht das Modul demzufolge nicht und kann es auch nicht ersetzen. Für das was Du möchtest sollte die Regel so aussehen:

Rule01: Find part of URL    burnfree.html
Rule01: Set part of URL    

Gruß
Andreas

Canonical URL Module - keine Ergenbisse
24 Thursday, 24 February 2011 10:33
Fred

nutze das bretteleben mod_canonical (bei anderen Projekten positive Erfahrungen gemacht)

Nutze in der .htaccess:

# mod_rewrite in use
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.versandapotheke-versandkostenfrei24\.de$
RewriteRule ^(.*)$ http://www.versandapotheke-versandkostenfrei24.de/$1 [L,R=301]

canonical plugin aktiv und Domain erfolgreich gecheckt.
leider werden keine canonical tags generiert, ich habe es schon mit einigen ,,Rules" im Modul versucht, auch nix.
Vielleicht hat jemand einen Tipp (Könnte es am Template liegen?)
Hier die addy: http://www.versandapotheke-versandkostenfrei24.de

Danke im voraus

@Fred
Thursday, 24 February 2011 20:08
A. Berger

Hallo Fred!

Nachdem mittlerweilen der TAG im HEAD vorhanden ist - was war denn das Problem?

Gruß
Andreas

Using this module with sh404sef
23 Thursday, 10 February 2011 05:24
Ian Thatcher

I have attempted to use this module with the sh404sef component enabled, the urls produced by the module are the non SEF version so not appropriate for a canonical version.
Can this module output the sh404SEF url ?
If so how can I get the module to display this form of the url ?

Thatch

@Ian Thatcher
Thursday, 10 February 2011 17:48
A. Berger

Hi Thatch!

If sh404SEF modifies the URL after the point in building a page than this module is executed, it has no chance to modify the sh404SEF-URL. As sh404SEF is a commercial extension, I have not tested against it but if the scenario is as suggested, the module will not work with it.

Best regards
Andreas

SEF und Joomla URL
22 Sunday, 06 February 2011 16:11
Achmed

Hallo,

Modul installiert und funktioniert sofort! Dafür schon mal ein großes Kompliment.
Eine Frage hab ich aber doch:

Ich verwende SefAdvance, trotzdem lassen sich die Seiten auch "normal" aufrufen. Beispiel:
http://www.yuu-skydive.de/tandemsprung_hamburg/tandemspringen.html

lässt sich auch als
http://www.yuu-skydive.de/index.php?option=com_content&view=article&id=16&Itemid=16

aufrufen. Klassischer Fall von "duplicate content". Mein Lösungsansatz:
Rule01: Find part of URL = /index.php?option=com_content&view=article&id=16&Itemid=16
Rule01: Set part of URL = /tandemsprung_hamburg/tandemspringen.html


Das klappt auch soweit, nur wenn die SEF-URL selbst aufgerufen wird, fügt das Modul trotzdem den Canonical-Link ein.
Ist das nicht doppel gemoppelt, sprich, mach ich mir damit die nächste Baustelle bei Google auf?

Gruß Achmed

@Achmed
Monday, 07 February 2011 21:02
A. Berger

Hallo Achmed!

Ich heisse zwar nicht Peter, aber trotzdem: Gern geschehen! :)

Gruß
Andreas

AW: SEF und Joomla URL
Monday, 07 February 2011 18:47
Achmed

Hallo Peter,

vielen Dank für deine prompte Antwort.
Das hätte ich auch so gedacht. Witziger Weise hat Herr Google aber irgendwie fast den gesamte "statischen" Inhalt auch mit nicht SEF-URL's indexiert. Warum auch immer? Ich hab keine Ahnung!
Anyway! Dein Modul funzt prima und wenn der "DoppelMoppel" nix macht, dann bekommt Herr Google eben noch ein paar generierte Canonical-Links verpasst und gut ist!

Vielen Dank noch mal und weiter gutes Gelingen!
Gruß Achmed

@Achmed
Sunday, 06 February 2011 19:17
A. Berger

Hallo Achmed!

Zu Deiner Frage: Nein, wenn die URL, die man aufruft mit der canonical URL im Quelltext übereinstimmt, dann ist das absolut kein Problem.

Zu Deiner Vorgehensweise: Die Frage ist nicht, unter welcher URL eine Seite theoretisch aufgerufen werden kann sondern unter welcher sie praktisch aufgerufen werden kann. Selbst wenn alle Seiten Deiner Webseite unter Umgehung von SefAdvance aufrufbar sind, solange sie mit dieser URL nirgends verlinkt sind - ist das absolut irrelevant: Woher sollte ein Spider denn diese URLs kennen? Tut er nicht.

Also, wenn die Verwendung von SefAdvance durchgängig ist und nirgends die nicht-modifizierten URLs aufscheinen, dann kannst Du Dir den Einsatz des Canonical URL Moduls - und eine Menge Arbeit - eigentlich sparen. :)

Gruß
Andreas

home page with JoomFish
21 Tuesday, 01 February 2011 14:26
Pieter

Works like a charm.. I only have got a small (or big) question...

I am using Joomfish on my site with 6 different languages.. I know how to set the module when there's no translation and english (default) should be in the canonical URL.
But how to set this... on the home page when I click another language (flag) I get the canonical URL with the extra /xx/  for the language.
www.domain.tld/xx/... then I go onward when I click home/accueill/start... in that particular language the canonical turns back into www.domain.tld ...no language in the canonical.
You can check at www.airshelter.com
Hope I did explain it a bit in a way you can understand ... sorry if I didn't... also the solution might be obvious and I didn't see.... call me stupid then :)

Regards,
Pieter


 

@Pieter
Tuesday, 01 February 2011 21:52
A. Berger

Hi Pieter!

The reason for this behavior is not caused by the module but by your main menu. Run a test:

a.)
- open the homepage
- change the language
- click an internal link
- click the back button in your browser
- open the source of the homepage: the canonical URL shows the set language

b.)
- open the homepage
- change the language
- click an internal link
- click the link to the homepage in the top menu
- open the source of the homepage: the canonical URL does not show the set language

The reason is, that the link goes to www.airshelter.com directly and not the link of the translated-page (e.g. www.airshelter.com/es.html). I guess you have to modify the main menu to have this link reflecting the URL of the translated page.

Best regards
Andreas

Final "?" at the end of url
20 Friday, 28 January 2011 02:51
Nicolas

First of all, many thanks for this fabulous module.

I began to work with it tonight and I solved many problems. Here is however a question. I used rules to eliminate the end of url in the canonical tag, for example:
http://www.healthhappinessmag.com/free-ebooks/cat_view/16-free-best-sellers-ebooks/18-personal-growth.html?limit=5&limitstart=0&order=date&dir=ASC
Everything works, except the final "?" at the end...
Now, my canonical tag for the above url is: http://www.healthhappinessmag.com/free-ebooks/cat_view/16-free-best-sellers-ebooks/18-personal-growth.html?


There is stille the "?". Is there a way to remove it ?
I use the docman component with Joomla 1.5.20

Thanks !

@Nicolas
Sunday, 30 January 2011 21:53
A. Berger

Hi Nicolas!

The rules look fine so maybe this is a bug of the module. I will run tests to check this. Meanwhile - and if you are sure that the parameters you are already removing are the only parameters on the pages you are using the module - you could add a fifth rule to remove the question mark explicitly:

Find part of URL: ?
Set part of URL:

Best regards
Andreas

The rules I use
Sunday, 30 January 2011 20:36
Nicolas

To put off the bad part of url, I use those rules:

limit=
limitstart=
order=
dir=


I put this in the first part of the rule parameter and I let empty the second part of the rule because I want the first part remplaced by nothing (just to erase it).

Thanks,
Nicolas

@Nicolas
Sunday, 30 January 2011 19:53
A. Berger

Hi Nicolas!

Up till now I cannot say what causes this behavior. Could you please post the rules you are using on this page?

Best regards
Andreas

English
Panoramic Image Viewer
Follow me on Google+

bretteleben.de

Add to circles

Who's Online
We have 46 guests online