Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the best way to do a 301 redirect from non-www '' to '' in IIS7.5?

Thank you

share|improve this question
up vote 5 down vote accepted

I would suggest that you install the URL ReWrite module for IIS 7 to do this for you. You would add a rule that looked soemthing like this

<rule name="Canonical Host Name" stopProcessing="true">
  <match url="(.*)" />
    <add input="{HTTP_HOST}" negate="true" pattern="somedomain\.com$" />
  <action type="Redirect" url="{R:1}" redirectType="Permanent" />

See this article for some hints and tips on URL ReWrite.

share|improve this answer
Sam, Is the condition required in this case since you've already wildcarded the URL? – Chris Anton Mar 31 '12 at 1:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.