Search code examples
excelhttp-redirectiis-7importbulk

how to bulk import 301 redirects in IIS 7 from csv or excel


is there a way to import/update 100's of 301 redirects in IIS 7 from excel or csv file

Excel file format currently consist of two column 1st column consists of old urls and the 2nd column consists of new url kinda like this format

https://support.3dcart.com/Knowledgebase/Article/View/297/12/how-do-i-import-my-301-redirects


Solution

  • Copy the redirects in XML format from the web.config file, e.g.:

    <configuration>
      <location path="services.htm">
        <system.webServer>
          <httpRedirect enabled="true" destination="http://domain.com/services" httpResponseStatus="Permanent" />
        </system.webServer>
      </location>
      <location path="products.htm">
        <system.webServer>
          <httpRedirect enabled="true" destination="http://domain.com/products" httpResponseStatus="Permanent" />
        </system.webServer>
      </location>
    </configuration>
    

    Paste that in a new notepad document. Save that as web.xml. Open it in Excel. Excel should automatically make a schema and it should come out in a similar format to what you want. Format it further if you need. Save it as a CSV.