URL Redirect Question?

I have an FTP that would like to host two web sites on in two different directories. I have two domain names that point to the same server.
QUESTION: Is it possible to redirect a user to a specific directory they type into their browser?
ie. If user types www.site1.com they are directed to www.mainsite.com/site1/index.html
and if user types www.site2.com they are directed to www.mainsite.com/site2/index.html

:q: