Solved

IIS 7 - Using Url Rewrites and then redirecting "everything else"

Posted on 2011-09-29
2
394 Views
Last Modified: 2012-05-12
I want to redirect certain pages from one site to certain other pages on our other site. Then I want to redirect everything that is left to one page on the other site.

I can use the http redirect to send the whole site over OR I can use URL Rewite to send certain pages to the other site's pages but I can't figure out how to do the "everything else" part.

Here's what I have so far. This wil redirect individual pages. When I added an http redirect, that takes precedence and the whole thing goes to newsite.com
              <rewrite>
            <rewriteMaps>
              <rewriteMap name="NewSite 301 Redirects">
                <add key="/contact.aspx" value="http://www.newsite.com/ContactUs.aspx" />
              </rewriteMap>
            </rewriteMaps>
            <rules>
                <rule name="Rewrite rule1 for NewSite 301 Redirects">
                    <match url=".*" />
                    <conditions>
                        <add input="{NewSite 301 Redirects:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                    <action type="Redirect" url="{C:1}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
0
Comment
Question by:EndeavorToPersevere
2 Comments
 
LVL 11

Accepted Solution

by:
G_H earned 500 total points
Comment Utility
I always add Rewrite via the GUI. I can see from the GUI side that there is the option to run a rule where the "pattern does not match"

My thinking here would go something like

Contact Rule (contact.aspx)
Next rule (next.aspx)
...

All other rule (NOT match contact.aspx) Do something else...

Would this work?

GH
0
 
LVL 2

Author Closing Comment

by:EndeavorToPersevere
Comment Utility
Perfect! Thank you!!!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Logparser is the smartest tool I have ever used in parsing IIS log files and there are many interesting things I wanted to share with everyone one of the  real-world  scenario from my current project. Let's get started with  scenario - How do w…
Lync server 2013 Backup Service Error ID 4049 – After File Share Migration
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 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