Controller as subdomain

Hello,

How can I make a controller like a subdomain?

Something like:

from :
localhost/controller/action

to:
controller.localhost/action

Example:
www.mysite.com/about
www.mysite.com/contact

where www and account are two different controllers.

Thanks