Support routes that start with /api (fixes #966)

Also, use them in some of the UI pages.