Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Redirecting all links below a subfolder IIS7

Posted on 2015-02-24
1
Medium Priority
?
228 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 29

Accepted Solution

by:
Dan McFadden earned 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

886 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