htaccess: migrate from apache 2.2 to 2.4


If you’ve been postponing your apache httpd upgrade to version 2.4, because changing hundreds of custom .htaccess files is giving you a headache, fear no more for there is a simple perl script that does it for you. I’ve been looking for a similar solution myself for some time now and didn’t find anything, so I’ve written it myself.

It’s nothing fancy, nothing really complicated and it probably doesn’t cover every possible scenario you might have, so if you find something that doesn’t work for you contact me, send me a pull request or whatever.

The usage is fairly simple and the code is published on github.

Usage: ./ htaccess_file

Get it from here.


About the author


iOS and OS X software engineer. Currently working in Berlin, Germany.


  • So, in change from 2.2 to 2.4, all the configuration phrases `require from all`, ‘deny from all` and so on, are deprecated, obsolete and there is no backward compatibility? Or maybe I wrong understood your script :)

  • Citing the official upgrade howto: "In 2.4, such access control is done in the same way as other authorization checks, using the new module mod_authz_host. The old access control idioms should be replaced by the new authentication mechanisms, although for compatibility with old configurations, the new module mod_access_compat is provided."

By Bartosz