Urlmanager For Rest And 'deep' Url

Apologies if I get the name of the concept wrong, but here is what I want:

Calling /post/2/comments should return the comments for post 2

Posting/Putting to /post/2/comments should create/update a comment for post 2

The reason I want /post/2 is for security (and for filtering/convenience). I.e. I will check that user is allowed to manipulate comments for postId

I would like to know how to define the urlManager in this case.

Is there any best-practice / existing documentation on this?



Also, I want to avoid the following:

Posts to /comments with postId as a parameter.

Although this would work technically, it doesn’t fit with my workflow (way of thinking)…