Tuesday, March 10, 2009

Preventing Apache from serving up directory contents

I've found the answer to this question (I previously posted it here). The options are laid out here. Essentially, you need to either change the file permissions for the directory, remove the Indexes directive or add an index.html file.

Update: This is the theory alright. However, I couldn't get it to work and I've found out why! :)

I ordered a book on Apache (after some deliberation - I only wanted to buy one) and it's excellent, so I'll mention it here. It's the O'Reilly Apache Cookbook (2nd Ed) and has lots of really good advice in. It's not a reference manual, but I figure I can check the syntax of Apache directives (and the like) online easily enough.

So, cut to the chase Ben. I was finding that my Indexes directives seemed to be ignored. For that fact, lots of things seemed to have no effect whatsoever to the way Apache was serving my TextPattern and WordPress pages. About the only effects I was able to get were the result of changing the file permissions of the pages was trying to serve, and that wasn't what I was attempting to do.

What I really couldn't get my head around was the Directives in my .htaccess files were being ignored. The magic Cookbook pointed me in the right direction though: my httpd.conf file was specifically preventing .htaccess files from affecting anything with the directive AllowOverride None. Whoops. Once I switched that from None to All WordPress and TextPattern started working as expected. And there was peace in my head.

This is what happens when
  1. you get a decent book and the time to read it, and
  2. you wake at 6am and can't sleep, and it turns out your brain is very lucid and alive to problem-solving at this time!
Adios.

No comments:

Post a Comment