Various improvments.

Mostly this pull request improves the end user experience by hiding error messages, redirecting on invalid URLs, and ignoring additional parameters. It also restricts the HTTP methods allowed for each endpoint to only the ones needed (plus "HEAD").
Other improvements are minor bug fixes and code tidy-up.