Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

how exactly can i specify that be rewritten to ? A

share|improve this question
Bit vague. More details would help elicit some answers. Do you mean that if the public type they should be redirected to ? – Izzy Nov 27 '09 at 20:38
Seems clear to me... This would be handled with a rewrite rule. IIS has a rewrite module that will take care of this very easily. See Scott's answer for more details. – Dscoduc Nov 28 '09 at 19:14
up vote 2 down vote accepted

To do a redirect from non-www to www using URL rewrite, you can:

  • Create a new rule
  • Set the "Using" to wildcards. You can use regex, but these instructions are for wildcards
  • Set * for the Pattern
  • Add a condition where {HTTP_HOST} matches
  • Set the action to "Redirect" with the URL as "{R:0}
  • It's a 301 permanent redirect that you most likely need. Search engines prefer that.
share|improve this answer
An excellent helper site to learn about URL Rewriting can be found at… – Dscoduc Nov 28 '09 at 19:19
That is a good site. Thanks @Dscoduc. I just blogged about this yesterday too, so here's a more detailed walkthrough for this particular situation… – Scott Forsyth - MVP Nov 28 '09 at 23:02
this is what i did, however, i have one issue still. the the entire path is not being changed over, it goes to If I append {R:1} i get errors. btw difference btween {r:0} and {r:1}? – zsharp Nov 29 '09 at 22:12
{R:1} should be the full path. If your pattern had multiple parts, like domain.(com|net) then you'll have results for {R:1} or others. You can use the "Test" mini-tools without URL Rewrite in IIS Manager to see the results. Make sure that you have a trailing / after your domain name in the redirect. – Scott Forsyth - MVP Nov 29 '09 at 22:48
When you create the rule, you can select the "Canonical Name" rule template and it'll do all this for you. – Eric Falsken Jan 21 '12 at 7:53

If you want the public that type into their browsers to be redirected to then it's quite straightforward.

Firstly you need to add anther A record into your public DNS zone to point to the same IP address as the www A record.

Then you need to configure the host headers for the site in IIS to respond to as well as www.

As good practice (it's been a while since I worked with webservers) in the past we've done this for www, ww, and w to help with typos.

share|improve this answer
Web client asks for and you want them to go to Not really a DNS function... – Dscoduc Nov 28 '09 at 19:20

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.