This repository contains a Perl script that automates the process of renaming web files and generating Apache .htaccess
Rewrite rules based on a list provided in a CSV file. It is designed to streamline the management of web resource naming on Linux servers as e.g. Debian or Ubuntu.
For your convenience, this repository contains as well an optional python 3 script rename_files.py that does the same, in case you prefer to work with python.
- File Renaming: Automatically generates a shell script to rename files on a Debian server.
- Apache Rewrite Rules: Generates Apache
.htaccess
rules to redirect old filenames to new ones, ensuring seamless user experience during website updates.
- Perl 5
Text::CSV
Perl module
Clone the repository to your local machine using:
git clone https://github.com/yourusername/webpage-renaming-tool.git
Ensure that Perl and the Text::CSV module are installed on your system. If you need to install the module, you can use CPAN:
cpan Text::CSV
Prepare a CSV file named webseiten_namen.csv with two columns: the old filename and the new filename.
Run the script using:
perl rename_files.pl
The script will generate two files:
- rename_files.sh : A shell script to rename the files.
- .htaccess : An Apache configuration file with the necessary Rewrite rules.
Ensure that the generated .htaccess file is placed in the directory where your webserver can read it, and that the mod_rewrite module is enabled.
Contributions to this project are welcome. Please fork the repository and submit a pull request.
This project is open-sourced under the MIT License. For more details, see the MIT License documentation.
Kai Froeb
Email: github@froeb.net Webpage: https://kai.froeb.net