www.sitename.com/username is a mapping you would have to set
up in your Internet server (not your applicaiton server). If you
wanted to automate the process, you'd probably have to figure out
how to write a script to interact with whatever web server you are
using (Win, Linux, Unix, etc). I'm hoping you get a good response
to your question on this forum, but its probably unlikely due to
the subject matter. A better place to post this question would be
on a site dedicated to those server technologies.