Auto-redirect to canonical URLs
The canonical URL scheme looks like this:
- / -> cpg.root.index()
- /index -> cpg.root.index()
- /a/ -> cpg.root.a.index()
- /a/b -> cpg.root.a.b()
In other words, objects always have trailing slashes, methods never have trailing slashes.
CP2 should enforce this scheme by automatically doing an external redirect if the incoming request URI isn't "correct". For example, if the user requests /a, CP2 should redirect to /a/ before actually calling cpg.root.a.index().
If we do this, request handler classes can safely use relative HTML links to refer to their own (or their parent/child objects') methods.
Reported by hmans