Catch Url Path As Action Parameter Under Certain Scenario

I currently have urlManager configured like this:

‘urlManager’=>array(

		'urlFormat'=>'path',


		'showScriptName'=>false,


		'rules'=>array(


			'<controller:\w+>/<id:\d+>'=>'<controller>/view',


			'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',


			'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',		


		),


	),

I would like to add rules that ensure the following:

Any request of the format http://mysite.com/userxyz or http://mysite.com/userxyz/ should return a page as though http://mysite.com/site/profile/id/userxyz 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 http://mysite.com/json/userxyz should return results as though http://mysite.com/site/profile/id/userxyz/api/json 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!! :)