IIS7 or .Net 301 Redirects from 1 domain to another
        Posted  
        
            by RandomBen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by RandomBen
        
        
        
        Published on 2010-06-15T14:25:40Z
        Indexed on 
            2010/06/15
            22:32 UTC
        
        
        Read the original article
        Hit count: 348
        
I have 2 domains. For the question, I will call them www.old.com and www.new.com. Both urls are pointing to the same IIS7 Site instance. I need to it up so that when someone goes to www.old.com they get a 301 redirect to www.new.com.
The tricky part is I am using URL rewrites for pages within the site. So www.old.com/About.aspx redirects to www.new.com/About. To get that to work with IIS7 URL rewrite rules, it also means that www.new.com/About.aspx redirects to www.new.com/About. That is fine and is not a big deal.
My issue is how do I redirect the main domain without losing the URL Rewrites from the sub pages?
I don't care if I use a module within IIS7 or if I need to do it in .NET code.
© Stack Overflow or respective owner