Apparently being smarter about MySQL than about mod_rewrite, I’ve managed to replace most of my permalinks with working ones. That doesn’t do inbound links any good, of course. Will keep tinkering.