Solved

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

Posted on 2011-09-29
2
397 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

First of all, clustering IIS is something you should rarely consider doing. In almost all cases, Microsoft Network Load Balancing (NLB) (http://technet.microsoft.com/en-us/library/cc758834(WS.10).aspx) is a much better solution when you need to p…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

809 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