Redirect Old Website Domain to New Domain Keeping Folder Path Structure with Web.Config

Redirect Old Website Domain to New Domain Keeping Folder Path Structure with Web.Config

Apologies for the obscenely long post title but I wanted to make sure I got all the keywords in that people might search for.  Why you may ask?  Well because I had a hell of a time getting an answer to arguably the single simplest form of URL Redirection you could possibly want to do:

Redirect Everything

The catch was that I wanted to redirect all traffic from my old domain name, to my new domain name, passing along the full folder structure as a 301 redirect (to pass on any search engine ‘good will’ to my new domain name).

So without further ado, here’s the code to put in to your web.config file:





 
 
 





For anyone looking to get in to ASP web development I’d recommend Beginning ASP.NET 4.5 (C# and VB) and for you IIS server admins out there, have one of these on your desk!: IIS 7.0 Administrator’s Pocket Consultant

Bob McKay

About Bob McKay

Bob is Director of Operations at Perfect Image, a full time father and husband, part-time tinkerer-with-wires, coder, Muay Thai practitioner, builder and cook. Loves love, tolerance and co-existance. Hates hate. Is aware of the irony of hating hate.

Disclosure Policy

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.