I recently formatted my PC – because it had begun to take forever to boot up. There have been instances where I would, literally, wait two minutes just to get to the desktop. I figured that the cause of my problem was possibly due to my system registry being packed with ancient entries, etc. – due to previously installed software and/or the fact that I was running out of hard disk space. The solution? Backup and format.
To get to the point… Because I re-started with a fresh OS install, I had to re-install Apache, MySQL, and PHP. I’ve done this several times in the past so everything was relatively easy to do. <non-sequitur> I typically use binaries (setup.exe) for my Apache and MySQL installations, and manual installation for PHP.</non-sequitur> I have never spent much time playing around with Apache because I either did not feel the need to and/or did not really have the time to do so. Anyway, after installing WordPress 2.0 (on the local host) I noticed that all index (i.e., “index.php”) references had been replaced with backslashes (“/”), which is fine, except that my Apache installation had not been configured to handle backslashes in a desirable way, instead, every backslash would show a directory listing. Not only is this insecure, it’s not a very efficient way to browse through a web site.
Wanting to alter this default behavior, I delved into the Apache manual that came with my installation (a somewhat daunting and intimidating task). After a while I happened upon a section dealing with automatic directory listings, apparently to disable this feature all that is needed is to add the following to my configuration (httpd.conf) file:
<Directory /path/to/directory> Options -Indexes </Directory>
Because something similar already existed, I merely added “Options -Indexes” and restarted my Apache server to see if that solved the problem. Well, it did, but instead of displaying the directory contents my server gave me a 403 – Forbidden error; which solves the problem, but creates another. I obviously needed to take this one step further.
Delving a bit further a noticed a reference to backslashes, directories and mod_dir.c; I read the entry and after doing the wrong thing for a while tried added the following after the “Options -Indexes” line in httpd.conf and restarted Apache again:
DirectoryIndex index.html index.htm index.php
And that fixed it. Cool. The complete segment:
<Directory /path/to/directory> Options -Indexes DirectoryIndex index.html index.htm index.php </Directory>
I was glad that I checked the manual because I did not want to waste hours searching the internet for a solution. Anyway, I just thought that I would share my experience; enjoy.