Pointing multiple domains (or subdomains) to a single module

How does one achieve this where you could have multiple domains pointing to the same module? For example

http://domain1.com -> points to myCustomModule

http://domain2.com -> points to myCustomModule

I am able to easily map a single domain by adding the following rules to the UrlManager component

'http://domain1.com/<controller:\w+>/<id:\d+>' => 'myCustomModule/<controller>/view'

'http://domain1.com/<controller:\w+>/<action:\w+>/<id:\d+>' => 'myCustomModule/<controller>/<action>'

'http://domain1.com/<controller:\w+>/<action:\w+>' => 'myCustomModule/<controller>/<action>'

but adding any more domains to the rules afterwards won’t work because the initial 3 domain1 rules would hijack those requests and create links pointing to domain1.com

Nevermind, I think I figured out a solution by creating a custom rule class to do what I need.