Canonical URIs or avoiding multiple URIs for a single page

Discuss PivotX 2.0.x here. Non-PivotX related discussions go in The Drain.

Canonical URIs or avoiding multiple URIs for a single page

Postby janozaurus » Sun Feb 22, 2009 9:20 pm

Hi all,
I can happen that the same entry in a Pivot site becomes known under several URIs. This will certainly happen when working with multiple weblogs (publishing the same content) or when not using mod_rewrite consistently (through the lifetime of the site) or in certain upgrade scenarios (/pivot/entry.php?id=123 to /?e=123).

It has long been considered best practise to choose one form of a URI as standard and redirect there from all variations of the URI. Google and other search engines now recommend to use something like '<link rel="canonical" href="http://somehost/canonical/form/of/the/URI" />' The latter can be done with templates in Pivot(X).

Are you going to address URI canonicalization "officially"? Is there an easy way to have PivotX send a HTTP "Redirect" header in certain situations?
Posts: 38
Joined: Mon Nov 26, 2007 9:03 am

Re: Canonical URIs or avoiding multiple URIs for a single page

Postby hansfn » Mon Feb 23, 2009 12:48 am

The PivotX developers are quicker than lightning - read this changelog.

In addition, check this excerpt from example.htaccess (coming with PivotX):
Code: Select all
# Some rules to make old Pivot URLs redirect to the new PivotX URLs.  You can
# remove this block if you are using a fresh install of PivotX, but if you are
# upgrading from Pivot these rules will make sure that you don't loose any
# visitors. (The rules might have to be adopted if you used non-standard
# locations for archive files and such.)
RewriteRule ^archives/archive_(.*)\.php index.php?a=$1 [R=301,L]
RewriteCond %{QUERY_STRING} id=([1-9][0-9]*)
RewriteRule ^pivot/entry.php index.php?e=%1 [R=301,L]
RewriteCond %{QUERY_STRING} c=([^&]*)
RewriteRule ^pivot/archive.php index.php?c=%1 [R=301,L]
RewriteCond %{QUERY_STRING} tag=([^&]*)
RewriteRule ^pivot/tags.php index.php?t=%1 [R=301,L]
RewriteRule ^rss\.xml$ /rss [R=301,L]
RewriteRule ^atom\.xml$ /atom [R=301,L]

Finally, PivotX will redirect non-rewritten URLs to the clean URLs if mod_rewrite is enabled (just as the old Pivot did), but probably not before 2.1 - since 2.0 is just around the corner.
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Return to 2.x Discussion

Who is online

Users browsing this forum: No registered users and 1 guest