Generate Rewrite Rules From CSV File

Here’s a simple Perl script that can be used to convert a CSV file of redirects into Apache rewrite rules:

The script assumes that you have 2 column – the source URL and the destination URL. You might invoke the script like this:

Sometimes the CSV file will be DOS formatted to I’ll do:

There are may ways that this script could be expanded or improved but it’s a good starting point for the typical case.

Have a project or a problem?

Talk with a senior engineer for practical recommendations—no obligation.

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.