Makes the template path matcher consistent with the path matcher

Especially with regards to the behavior with leading/trailing slashes (plus updated tests)