Johannessen Design Bureau

2009-10-03

WordPress and duplicate content

WordPress has come a long way with regards to it’s default URL scheme. I needed only two minor tweaks to make me completely happy with it. The first one really isn’t WorPress’ fault either. I really dislike publishing the same content on http://host.example/... and http://www.host.example/..., but at the same time I want to be able to accept incoming links with both hostnames. The solution is pretty well known, though I choose to turn it on it’s head: I remove the www from the hostname using Apache rewrite rules:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^db\.org$ [NC]
RewriteRule ^(.*)$ http://db.org/$1 [R=301,L]

The [NC] flag makes the condition case insensitive. I don’t think I’ve ever seen a HTTP client send the Host: header in anything except lower case, but the relevant standards certainly allow for it.

The R=301 flag tells Apache to make this a permanent redirect. This allows clients to update the links at their end. The L flags tells Apache to stop the rewriting process here and don’t apply any more rewrite rules. This is probably needed if you have additional rewrite rules in your .htaccess file.

The second thing bugging me is the way WordPress does paging. You get a predefined number of posts on the front page, and links to /page/2/, /page/3/ and so on. This holds true for archive, category, tag-cloud and probably others pages as well. The problem with this is that the content on these pages are not stable (it shifts as you post new content) and it duplicates content. I’m still pondering a solution to this…

Igang igjen

Da gjør vi nok et forsøk på å gjenopplive bloggen. Jeg har tatt med litt innhold fra forrige gang jeg gjorde et forsøk, og utfra datostempelet på disse kan det sees at det er nærmere seks år siden sist jeg skrev noe nevneverdig. Skal forsøke å poste litt hyppigere i tiden fremover :-)

Denne gangen blir det nok også en lett blanding av Norsk og Engelsk. Norsk for ting som stort sett bare er interessant for de som snakker norsk allikevel, og Engelsk for resten.

Copyright © 1997-2010: Bård Johannessen - Entries: RSS - Comments: RSS - Powered by: WordPress