How to make a link with subsite?

Hi, I am setting up a blog net work with New Blog Template.

My questions is when a new subsite is created with New Blog Template, I would like to make some links to according to subsite url.

For example,

If a profile page of the main site is http://www.mysite.com/my-profile ,

when a subsite (username / URL is “red” ) is created, the subsite also generate the link like http://www.mysite.com/red/my-profile

I assume you do this with some php code in url like p=1223? or something, but I have no idea.

Could you give me an advice?

Thank you.