301 redirect secondary domains to primary domain

I have a primary domain and 2 other secondary domains for my site. If someone visits one of the secondary domains, I want them to be redirected (HTTP 301) to the same page on the primary domain.

Is there a simple rule I can add to the web.config for the rewrite module?

I could write an http module that hooks into beginrequest but I would be surprised if there wasn’t an easier way to achieve this using a rewrite entry in web.config.

Very easy – easiest way to get it is to go into the IIS manager’s url rewrite tools and choose add rule then cannonical url.

That’s exactly what I needed - thank you.