IIS7 or .Net 301 Redirects from 1 domain to another
- by RandomBen
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.