Received: (qmail 81337 invoked by uid 501); 24 Mar 2001 07:19:51 -0000 Message-Id: <20010324071951.81336.qmail@apache.org> Date: 24 Mar 2001 07:19:51 -0000 From: Aycan Gulez Reply-To: aycan@wowwebdesigns.com To: submit@bugz.apache.org Subject: Apache overrides rewrite engine directives, automatically returns a PHP file even if only its name matches (not its extension) X-Send-Pr-Version: 3.110 >Number: 7455 >Category: mod_rewrite >Synopsis: Apache overrides rewrite engine directives, automatically returns a PHP file even if only its name matches (not its extension) >Confidential: no >Severity: critical >Priority: medium >Responsible: apache >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Fri Mar 23 23:20:00 PST 2001 >Closed-Date: Wed Mar 28 15:54:15 PST 2001 >Last-Modified: Wed Mar 28 15:54:15 PST 2001 >Originator: aycan@wowwebdesigns.com >Release: 1.3.19 >Organization: >Environment: Linux 2.2.16 #22 i486 unknown (slackware 7.1) >Description: I don't know if this is a standard behavior of Apache, but even if it is so there seems to be a bug that interferes with mod.rewrite. If Apache cannot find the requested file name or directory it automatically looks for a matching file, and if it finds one, it returns the contents of that file even if its extension doesn't match. The problem is compounded with PHP files and rewrite rules (some of the rules are not executed if they conflict with this behavior). I included an actual example. >How-To-Repeat: There is a single file called a.php in http://www.wowwebdesigns.com/test/ . You can see it if you visit the above URL. If you enter http://www.wowwebdesigns.com/test/a (note that there is no extension) Apache should return an error, but it rather returns a.php (you should see 'Gotcha!'). It is even worse when you enter something like this http://www.wowwebdesigns.com/test/a/abc . It still works. This behavior ruins some of my rewrite rules. I didn't change anything in my configuration files. I was using 1.3.12 before, and everything was working fine. When I updated Apache to 1.3.19 I noticed the problem. For instance, the following rule doesn't work anymore if a.php exists (the rule is not even executed): RewriteBase /homedir/aycan/test RewriteRule ^a/id_([0-9]+)/$ a.php?id=$1 >Fix: Unfortunately no. >Release-Note: >Audit-Trail: From: "William A. Rowe, Jr." To: , , Cc: Subject: Re: mod_rewrite/7455: Apache overrides rewrite engine directives, automatically returns a PHP file even if only its name matches (not its extension) Date: Sat, 24 Mar 2001 11:13:20 -0600 From: "Aycan Gulez" Sent: Saturday, March 24, 2001 1:19 AM >If Apache cannot find the requested file name or directory it automatically >looks for a matching file, and if it finds one, it returns the contents of >that file even if its extension doesn't match. Try removing Option -> Multiviews from the directory in question, since that's the module that walks around the file extension. State-Changed-From-To: open-closed State-Changed-By: slive State-Changed-When: Wed Mar 28 15:54:13 PST 2001 State-Changed-Why: Closing this report because Bill provided the solution in email (Options -Multiviews). >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]