This tiny console application takes a simple CSV file and generates a <rewrite>
XML block that can be inserted into a web.config file on an IIS server that supports the IIS Rewrite module.
CsvToIisRewriteRules.exe -p <csv-file-path> -o <output-directory> [-s] [-a <destination-url>]
Specify the path to the CSV file. The file must be in the following format:
http://source-domain.com/source/page-1,https://destination-domain.com/destination/page-1
http://source-domain.com/source/page-2,https://destination-domain.com/destination/page-2
The directory into which to write the config file(s) generated by the application.
If -s
is specified, the config files will be broken out as follows:
This file contains the <rewriteMaps/>
element, containing all the <rewriteMap/>
elements and their individual rewrites.
This file contains the <rules/>
element, containing all the rules which reference the rewrite maps.
This file contains references to the rewriteMaps.config
and rules.config
files generated above.
Note: this file is the default file that is generated and will contain all configuration if the
-s
parameter is not specified.
If -a
is specified, the last rule
definition will catch all URLs that weren't matched and send them to the passed-in <destination-url>
.