Generate HTTP 301 redirect rules from URL lists and filenames.
From a supported input format of URLs, fuzzy search a directory for filenames that are a sub-string of a URL and output a mapping in one of the supported output formats to stdout.
An input format can be one (or any) of:
- Google Webmaster Tools crawl errors CSV file
- A newline separated list of URLs
- rack-rewrite 301 static redirect
- Comma separated list
$ gen301 -use \
--gcsv /tmp/Web_crawl_error_sources_www_tlvince_com_20110711T030411Z.csv" \
--plain /tmp/disqus-urls.csv \
--dirs ~/proj/blog/journal/entry \
--output rack | sort > /tmp/301s
... which generated these redirects in production.