Dear Thorsten Rinne
There are many methods/strategies to uniquely identify an item in the world - being it a book, a grocery product, a software component, and so on.
One method wildly used in computing areas is the UUID (Universally Unique Identifier) - and the GUID, Globally Unique IDentifier.
There are free implementations of the algorithm(s) written in several languages (JavaScript, PHP, etc).
phpMyFAQ uses an auto-incremented sequential number to identify records - FAQ articles, categories, etc -, that is, IDs. The increment value is user-definable.
While this approach is simple and fast, it may cause some problems (as some users have reported).
Examples
- If the increment value is changed, there is the possibility of generating an already existing ID.
- If someone wants to merge two or more (FAQ) databases, the resulting DB may contain duplicated record IDs (the administrator must be aware of this possibility, but errors occur …)
This situation may also occur after changing a FAQ’s category.
So, using UUIDs “v.4” [1] or “v.5” [1] to identify records (and other elements) is an option in order to minimize this kind of situation (it is possible to generate duplicated UUIDs but the probability is very low).
Generating a new UUID ID is slower than generating a new numeric ID - but it happens only once per record/entry.
A UUID “v.4”/”v.5” value can’t be used to sort records by their creation [2] sequence - and comparing strings is slower than comparing numbers -, so for this purpose it is possible to use an extra numeric field (similar to the current record ID) or just the numeric value of the creation date field.
Returning to the rewrite operation.
Using UUIDs, the administrator has two rewrite options:
- the current approach (with the question’s text – prone to changes and possibly long);
- the record UUID (“permanent”).
URLs with “v.4” UUIDs don’t need to be URL-encoded (percent-encoding).
Another advantage: the record's UUID value may be used in the RSS <guid> optional element (this avoids feed validators complaints).
Examples
- Without rewrite statements
http://faq.example.com/index.php?action=artikel&cat=1&id=23&artlang=en - With the current rewrite method
http://faq.example.com/content/1/23/en/the-question_s-text-that-is-prone-to-changes_and-possibly-long_very-long-or-with-diacritic-characters.html - Using UUIDs on the rewrite
http://faq.example.com/a7a67b6c-f7c8-4dc4-9da5-235a64d48e5a
For non-specialists
[1] RFC 4122. More recent documentation about this subject is available.
[2] A UUID “v.1” contains the creation date/time but has security problems – it includes the host MAC address.
[3]
Kind regards
2010-12-28
pt20100201