[drupal-devel] [bug] .htaccess - issue with rewriting to cgi's
Issue status update for http://drupal.org/node/28423 Post a follow up: http://drupal.org/project/comments/add/28423 Project: Drupal Version: 4.6.0 Component: other Category: bug reports Priority: normal Assigned to: Anonymous Reported by: davek@davekaufman.net Updated by: davek@davekaufman.net -Status: active +Status: patch (code needs review) Attachment: http://drupal.org/files/issues/htaccess_3.patch (375 bytes) The patch in question. davek@davekaufman.net Previous comments: ------------------------------------------------------------------------ Mon, 08 Aug 2005 03:43:25 +0000 : davek@davekaufman.net 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?
participants (1)
-
davek