After attempting to create a custom rewrite rule that had nothing to do with drupal, I noticed that the following rules in the default .htaccess file were being too greedy and seemingly matching every URL provided:

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

as near as I can determine, the problem arose from the fact that my custom rewrite was dealing with a cgi. Specifically, I was attempting to rewrite a URL of the form:

http://domain.tld/finger/username

to the form

http://domain.tld/cgi-bin/finger.pl?user=username

but it wasn't working.

After beating my head against it for a couple hours, I discovered that mod_rewrite can be set to log what it's doing, which is when I found the overly greedy rules.

The fix (or at least the fix I discovered) is to add the following line to that section of the .htaccess file:

RewriteCond %{REQUEST_FILENAME} !.*cgi-bin.*

which says, in essence, "any URI that contains the string 'cgi-bin' is exempt from the following RewriteRule"

I've included a "patch" containing this change. Rewriting URLs for cgi's is a pretty common thing to do, can someone please verify this issue?

CommentFileSizeAuthor
#1 htaccess_3.patch375 bytesdavek@davekaufman.net

Comments

davek@davekaufman.net’s picture

Status: Active » Needs review
StatusFileSize
new375 bytes

The patch in question.

morbus iff’s picture

Won't fix. We can't cater to every user installation possible, and guessing at a thousand exclusions of possible directories is foolish.

morbus iff’s picture

Assigned: Unassigned » morbus iff
Status: Needs review » Closed (won't fix)