title: URL Rewrite Map and Wordpress
body: <p>I am working on a migration from ASP.NET to Wordpress and I want to put 301 redirect rules in place using a Rewrite Map with URL Rewrite in IIS 7.5.  I have all the redirects in a file named rewritemap.config, and I've created the redirect rule in URL Rewrite in IIS, but I can't get the redirect to work with Wordpress.  I don't know if this is possible with Wordpress having it's own rewrite rule in the web.config as well to send everything to index.php where it handles it's own rewrites internally as explained in this link:</p>
  
  <p><a href="https://stackoverflow.com/questions/4785840/how-does-wordpress-rewrite-the-url-without-a-rewrite-map">How does Wordpress rewrite the URL without a rewrite map?</a></p>
  
  <p>The XML for the web.config is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
    &lt;system.webServer&gt;
      &lt;rewrite&gt;
        &lt;rewriteMaps configSource="rewritemap.config" /&gt;   
        &lt;rules&gt;
  
                  &lt;rule name="Redirect old links from redirect map" stopProcessing="true"&gt;
                      &lt;match url=".*" negate="false" /&gt;
                      &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="false"&gt;
                          &lt;add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" /&gt;
                      &lt;/conditions&gt;
                      &lt;action type="Redirect" url="{C:1}" appendQueryString="false" /&gt;
                  &lt;/rule&gt;
  
  
                  &lt;rule name="wordpress" enabled="true" patternSyntax="Wildcard"&gt;
                      &lt;match url="*" /&gt;
                      &lt;conditions logicalGrouping="MatchAll" trackAllCaptures="false"&gt;
                          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
                          &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
                      &lt;/conditions&gt;
                      &lt;action type="Rewrite" url="index.php" /&gt;
                  &lt;/rule&gt;
  
        &lt;/rules&gt;
      &lt;/rewrite&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>The XML for the rewritemap.config file was created by IIS Admin so I expect that it is correct and it matches the format I've seen on other blog posts that have shown how to do this.  Am I attempting something impossible with this?  I have hundreds of old aspx pages I need to 301 redirect to specific links in the Wordpress site and there are to many external references to the old links to even think about not having the 301 redirects in place. </p>