Efficient .htaccess

February 2nd, 2013
tech
In Apache you can put configuration files in each directory: .htaccess files. Every time someone requests a page, however, Apache needs to check for a .htaccess file in that directory, reading and parsing it if it exists. Switching to <Directory> blocks in your main config is much faster, but many places like shared hosting environments can't do that. A solution here might be to add an option to relax Apache's promise of rereading .htaccess files on every request. Instead it could search for them and parse them on startup, and you could either send it a signal to tell it to reload them or it could watch them with inotify.

As a workaround for now, you could use a converter like this one that reads all your .htaccess files and collects them into a htaccess.conf. (You'd run with AllowOverride off.) If you wanted to use this in a shared environment, though, you'd need to parse the config and check that it's safe, not containing an "</Directory>...<Directory ...>" or other injection.

Referenced in: Apache doesn't cache htaccess configs

Comment via: google plus, facebook

Recent posts on blogs I like:

Starting With Chords

A lot of people play fiddle. Basically nobody starts by learning chords before learning melodies. But that's actually how I learned. I started with chords. One of the nice things about learning to play violin this way is that you can go busking even…

via Anna Wise's Blog Posts November 15, 2024

Stuffies

I have some stuffies and I just have a bunny. Bunny is a rabbit. Woof is a seal. My favorite stuffie is bun bun. I play with my stuffies. Sometimes I jump up with them and I roll them. I can just throw them in the air when I want to play bthululubp wi…

via Nora Wise's Blog Posts November 15, 2024

You Can Buy A Malaria Net

2024 election takes

via Thing of Things November 6, 2024

more     (via openring)