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 account.mysite.com/register account.mysite.com/login

where www and account are two different controllers.

Thanks