different page per url

i have 2 domains pointing to my board now i would like the function
when a users uses the domain.com he just get index.php but when he visits from domain2.com he gets index.php?page=pageid
does someone knows how i can create this?
i would love to do this with .htacces but don't know how
when a users uses the domain.com he just get index.php but when he visits from domain2.com he gets index.php?page=pageid
does someone knows how i can create this?
i would love to do this with .htacces but don't know how