Catch Url Path As Action Parameter Under Certain Scenario

I currently have urlManager configured like this:










I would like to add rules that ensure the following:

Any request of the format or should return a page as though had been called, with "site" being the controller, "profile" being an action inside that controller and "id" being a parameter of said action and "userxyz" being any random alphanumeric string that may include the following three elements as well . - _

But now also in addition to that I’d like to have it return the user profile in a format that standard APIs understand, so for example should return results as though had been called

But if I call http://mysite/somecontroller or http://mysite/somecontroller/someaction or http://mysite/somecontroller/someaction/someparam/somevalue it should return everything as it already does.

Thanks much in advance! Love the framework!! :)