I have an exising site that I would like to use some subdomains to promote different aspects of the site. However, I really can't move these pieces to another virtual site, so I'm looking to use js to redirect a request to another page.

Here's what I want to do.

Point the following domains to a single ip:

shop.powwows.com
gathering.powwows.com

On the single ip, have an index page that would read the header of the request and route shop.powwows.com to www.powwows.com/shop and gathering.powwows.com to www.powwows.com/gathering/

Would this work?

What would I need to put in js to do this?

Or is there a better way?