Is it possible to do a 301 redirect AND redirect to the requested resource?

Posted by Pure.Krome on Server Fault See other posts from Server Fault or by Pure.Krome
Published on 2009-10-19T04:33:04Z Indexed on 2012/03/31 23:34 UTC
Read the original article Hit count: 232

Filed under:
|
|

For one of our projects, we're doing a rebranding of the website name, logo, etc...

As such, we need to 301 Moved Permenantly redirect all users from the old domain to the new domain. With IIS7, that's pretty simple. We just create a new website that redirects all traffic to a host-headered domain .. to the new one.

But this loses their original destination resource.

eg.
Old Domain: www.OldDomain.com
New Domain: www.NewDomain.com

User: www.OldDomain.com/user/PureKrome  -> 301 --> www.newDomain.com

Notice how it's going to the new domain BUT not to /user/PureKrome?

How can I do this so it goes to the new domain and keeps the original resource request? I'm guessing URL-ReWriter for IIS7 might help?

Also, what happens if I want to do this...

CurrentDomain 1: Domain.com
CorrectDomain 1: www.Domain.com
CurrentDomain 2: AnotherDomain.com
CorrectDomain 2: www.AnotherDomain.com

Is it also possible to have those in the same IIS website? So any URL to domain.com will 301 to www.domain.com

Right now I'm making 2 IIS websites, with a 301 hardcoded (which still means I lose the original resource request, too).

Help!

© Server Fault or respective owner

Related posts about iis7

Related posts about redirect