WordPress, Apache, and mod_rewrite. Oh my!

I spent today (re)learning mod_rewrite, but I’m quite confused about a couple of things. See if you can pick them out of the .htaccess file:

I didn’t think so. Unfortunately, this little bit of seemingly correct code has a few interesting problems.

Weird behavior with DirectoryIndex

First, the entire custom block doesn’t work as expected. The code is “correct,” but mod_rewrite never fires for requests made to “/?s=asdf”. However, if I modify it to “/index.php?s=asdf”, it works like a champ. In fact, at one point, I even did this ridiculous test as my entire .htaccess file:

The first code listing above matches what is presently in my .htaccess file if you want to poke at it.

Devious Information Leaking

Being a website, there are additional folders in my webroot whose presence I may not wish to advertise. For example, this setup reveals that there is a folder at /user/files. Compare the results to this 404: /does/not/exist. We have manifested a trailing slash for existing folders!


I don’t know the solution for either of these two issues. Even if I add


it doesn’t play nicely. Maybe this is an issue with DreamHost and what they will