How to redirect a specific domain to a sublevel page on a different domain using URL Rewrites in IIS7

Anytime I have to look up something twice in three days I figure I might need that info again. Sometimes you have multiple domains pointing to the same site one of which might be a “marketing domain”. Here’s how to redirect a domain request to a page on a different domain.

  • Select URL Rewrite
  • Select Blank rule
  • Enter the pattern
    (.*)

     NOTE: This means any character, any number of repetitions.

  • Expand Conditions if not already expanded and Click “Add”.
  • Enter
     {HTTP_HOST} 

    for “Condtion Input”. (Curly braces are required)

  • Set “Check if input string” to “Matches the Pattern”
  • Pattern
    (?:www.)?domain.com 

    where domain is the domain to redirect. (The part

     (?:www.)? 

    makes www. optional

  • Enter the URL such as
    http://www.newdomain.com/sub/page1.aspx
  • Enter “Redirect” for action
  • Redirect type should be 302 if this is temporary, 301 for permanent redirects. Browsers cache 301 redirects so if it changes in the future, it may take a while for users to know about it.
  • One thought on “How to redirect a specific domain to a sublevel page on a different domain using URL Rewrites in IIS7

    Leave a Reply

    Your email address will not be published. Required fields are marked *