I have reduced my actual problem to a simple one:
I have some php scripts that display text. E.g.
http://example.com/articles.php?id=2
could display an article with title My little cat
.
However, the url is ugly for sharing. How can I implement a system whereby a user types something like http://example.com/articles/My_little_cat
and be redirected to the same place?