Solved

Redirecting all links below a subfolder IIS7

Posted on 2015-02-24
1
211 Views
Last Modified: 2015-04-09
Hi all,

I'm having an issue applying a redirect on IIS7, Windows Server 2008 R2.

I need every link after a certain subfolder to redirect to a different domain with the same folder structure.

example:

www.exampleolddomain.com/sub-folder/example1

to redirect to

www.newdomain.com/sub-folder/example1

and

example:

www.exampleolddomain.com/sub-folder/example2

to redirect to

www.newdomain.com/sub-folder/example2

etc.

I need one redirect to to cover any and all sub-subfolders, I assume with some kind of wildcard?

I have tried switches

$V and $P without success, but not 100% sure I applied them correctly.

Any help and/or successful examples would be gratefully appreciated.

Thanks
0
Comment
Question by:ncomper
1 Comment
 
LVL 26

Accepted Solution

by:
Dan McFadden earned 500 total points
ID: 40658258
You can add this to the web config file of the website:

<rewrite>
     <rules>
         <rule name="Redirect old domain to new domain" patternSyntax="Wildcard" stopProcessing="true">
             <match url="*" />
             <conditions>
                 <add input="{HTTP_HOST}" pattern="old-domain-name.com" />
             </conditions>
             <action type="Redirect" url="http://www.new-domain-name.com/{R:0}" />
         </rule>
     </rules>
 </rewrite>

Open in new window


The {R:0} maintains the path of the original request.

Dan
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now