API: Don't allow dots in URL segments

Thanks to @zannstpierre for the original pull request in #1201