28 May 2006, 23:30 by mark hoekstra

funky clean URLs and permalinks

Permalinks/clean URLs at my site have been troublesome since I first looked into them. At the first moment I was running this site on NetBSD and somehow on that configuration, nothing worked fine besides the messy URLing (like /index.php?=messy) (which of course had nothing to do with running on NetBSD, it just happened to not work…). Next to that I was way too happy with my upgrade from a 180MHz R5000 to a 1200MHz Athlon Thunderbird back then, so I had enough other things to play with…

Anyways, later on, I moved this site to Gentoo on my current server and somehow, the clean url-ing started to work only the title-part of the clean-url wouldn’t ‘render’ at all and I had no clue where to look. After some upgrades and reconfigurations for other reasons, the title-part started to work also, but still not completely satisfactory…


it’s amazing what Google Images comes up with when you search for an appropriate image for ‘permalink’ *^_^*

This sunday-afternoon I decided I had enough of that and got to grips with permalinks *^_^*

...also because I don’t/didn’t want this thing to grow into some monster with permalinks being everything besides permanent…

So… what was the problem? Even though textpattern told me I enabled the “Permalink title-like-this (default is TitleLikeThis)” -option… I still got URLs like http://geektechnique.org/blog/640/Elsieneededafix

So the titles wouldn’t get dashes(hyphens) in the titles and it wouldn’t lowercase them also, whatever I did…

...so… after a looooong investigation (this took me all afternoon) where the bottleneck to this problem could be… I finally found it… it seemed the ‘internal script encoding’ in my php.ini was set to EUC-JP (japanese?) and when I changed that to UTF-8 (which my Apache-install likes much better…) things started to work… at least… on new articles… so after that I found myself in yet another MySQL-crashcourse in where to find the url_titles in my database and how to delete the contents of that, in such a way Textpattern would start to ‘render’ the clean urls again, and this time in a way how I liked to see them, lowercase and with hyphens…

So this is what I did (I googled several times for this problem, to no avail, so maybe I help someone else out with this, googling for the same…)

In my php.ini I changed mbstring.internal_encoding to UTF-8:

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
mbstring.internal_encoding = UTF-8

and I did the following on the MySQL-commandline…


mysql> connect textpattern;

mysql> show tables;

mysql> show columns from textpattern;

mysql> SELECT url_title FROM textpattern;

mysql> UPDATE textpattern SET url_title='';

mysql> SELECT url_title FROM textpattern;

and tada! empty url_titles!

(there’s quite some slack in the commands here… only the ‘connect’ and the ‘update’ commands with are necessary… I like to double-check everything (and did this first to my geektechnique-test-environment (yes! there is one! ;-)) before I did this to the live-database…)

So… permalinks now actually have a chance to become permanent this way :-)

Well, this must be one dull post… ;-)

permalink - add to del.icio.us

As mentioned in the Message from Mark's family this site has been made static. This means that it will be no longer possible to comment on his ideas and projects, but that we all can continue to cherish his creativity.

previous: B R I G H T 09 in stores now...

next: BRIGHT Nerd Alert: the video