Solved

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

Posted on 2011-09-29
2
400 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
ID: 36817420
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
ID: 36817481
Perfect! Thank you!!!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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