The Apache docs say (http://httpd.apache.org/docs/2.4/howto/htaccess.html),
\"You should avoid using .htaccess files completely if you have access t
A Digital Ocean tutorial at https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file says,
"The .htaccess page may slow down your server somewhat; for most servers this will probably be an imperceptible change."
I quote from a tutorial on .htaccess by Joseph Pecoraro on code.tutsplus.com here:
Also, when [.htaccess is] enabled the server will take a potential performance hit. The reason is because, every server request, if .htaccess support is enabled, when Apache goes to fetch the requested file for the client, it has to look for a .htaccess file in every single directory leading up to wherever the file is stored.
These potential file accesses (potential because the files may not exist) and their execution (if they did exist) will take time. Again, my experience is that it's unnoticeable and it doesn’t outweigh the benefits and flexibility that .htaccess files provide developers.
For your scenario, my personal recommendation would be like "Don't fix what isn't broken", because time and effort is equal to money, and I fully agree with your reasoning in this comment.
That slide shows the impact of htaccess files with either no htaccess file, the htaccess file in the root folder as well as in subfolders in comparison to the no htaccess baseline.
It is hard to give numbers as the impact depends on the speed of your hardware and how much memory are you willing to dedicate for file caching, but let me give you an example that should clarify the impact - let say you have a wordpress site and an image which is located at /wp-content/uploads/2015/10/my.png needs to be served.
While serving this file might take 1 disk access, just to check out for all the possible .htaccess you will need additional 5 disk accesses. If the file is big the overhead might not be noticeable, but for a small file that might even fit into one block on the disk you waste 80% of the time doing things that are not needed at all.
Still, big enough cache can fix almost any design/coding problem, but the more directories you will have the bigger the cache that you will need to avoid degradation of performance.
In your specific case it is actually a no brainer at all. You already generate the htaccess files so all you need to do is wrap them in a directory directive, generate them into some directory and include them from http.conf. Even doing it manually should not take more then a few hours and after that you have a better architecture of your server.
From an answer on Quora by Jonathan Klein, 12ms for a 1500 line .htaccess
file:
Having a large .htaccess does have a cost. Ours is currently ~1500 lines and we benchmarked the time spent parsing it at around 10-12ms on a production webserver. Hardware makes a difference obviously, but you can fairly safely assume that the cost of that 3000 line .htaccess is around 25-35ms per request.
The httpd.conf is parsed one time. If you use .htaccess it'll get hit every time something is called. That'll cause a fairly large performance hit that will just get worse with increasing requests.