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.
  • Updating DNN to friendly URL’s without hurting your SEO

    I manage several DotNetNuke sites and noticed I had not enabled friendly URL’s on one. This is a typical DNN URL…which is not very intuitive
    http://www.mainesgna.org/AboutMSGNA/SGNAMembershipBenefits/tabid/67/Default.aspx

    Using the Friendly URL feature this is the same page’s URL:
    http://www.mainesgna.org/AboutMSGNA/SGNAMembershipBenefits.aspx

    I wanted to changed the URL scheme, but I didn’t want lose my search rankings so needed to create a rewrite rule to inform search engines with a 302 redirect that the pages have a new home. I use the Helicon product ISAPII Rewrite.

    Here are the steps to do this.

    1. Enable Friendly URL’s in Web.Config. Do this by adding the urlFormat attribute of HumanFriendly to the friendlyUrl node:
            
      
      
            
              
              
            
          
      
    2. Create a Rewrite Rule for isapii Rewrite 2
      RewriteCond Host: www.yourdomain.com
      RewriteRule ^(.*)/tabid/d+/Default.aspx$ $1.aspx [I,RP,L]
    3. The Syntax for Isappi Rewrite 3 is:
    4. RewriteCond %{HTTP:Host} ^www.yourdomain.com$
      RewriteRule ^(.*)/tabid/d+/Default.aspx$ $1.aspx [NC,L,R=301]

      If your not using the lite (free) version of Helicon, and your rewrite file is in the DotNetNuke web root, you can skip the ReWriteCond line.