Received: (qmail 48275 invoked by uid 501); 26 Apr 2001 14:32:33 -0000 Message-Id: <20010426143233.48273.qmail@apache.org> Date: 26 Apr 2001 14:32:33 -0000 From: Christopher McCrory Reply-To: chrismcc@pricegrabber.com To: submit@bugz.apache.org Subject: mod rewrite does funky things with ~username X-Send-Pr-Version: 3.110 >Number: 7631 >Category: mod_rewrite >Synopsis: mod rewrite does funky things with ~username >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Thu Apr 26 07:40:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: chrismcc@pricegrabber.com >Release: 1.3.19 >Organization: apache >Environment: [chrismcc@www1 chrismcc]$ uname -a Linux www1.pricegrabber.com 2.2.19-6.2.1enterprise #1 SMP Mon Apr 9 22:36:08 EDT 2001 i686 unknown [chrismcc@www1 chrismcc]$ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) [chrismcc@www1 chrismcc]$ httpd -V Server version: Apache/1.3.19 (Unix) (Red-Hat/Linux) Server built: Mar 14 2001 09:08:03 Server's Module Magic Number: 19990320:10 Server compiled with.... -D EAPI -D EAPI_MM -D EAPI_MM_CORE_PATH="/var/run/httpd.mm" -D HAVE_MMAP -D HAVE_SHMGET -D USE_SHMGET_SCOREBOARD -D USE_MMAP_FILES -D USE_SYSVSEM_SERIALIZED_ACCEPT -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard" -D DEFAULT_LOCKFILE="/var/run/httpd.lock" -D DEFAULT_XFERLOG="/var/log/httpd/access_log" -D DEFAULT_ERRORLOG="/var/log/httpd/error_log" -D TYPES_CONFIG_FILE="/etc/httpd/conf/mime.types" -D SERVER_CONFIG_FILE="/etc/httpd/conf/httpd.conf" -D ACCESS_CONFIG_FILE="/etc/httpd/conf/access.conf" -D RESOURCE_CONFIG_FILE="/etc/httpd/conf/srm.conf" The server is linux, RedHat 6.1, with many updates >Description: [chrismcc@www1 chrismcc]$ tail -f /var/log/httpd/rewrite.log 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (2) init rewrite engine with requested uri /~chrismcc/mytest.php/HERE/THERE/EVERYWHERE 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (3) applying pattern '(.+)\.php/(.+)/(.+)' to uri '/~chrismcc/mytest.php/HERE/THERE/EVERYWHERE' 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (2) rewrite /~chrismcc/mytest.php/HERE/THERE/EVERYWHERE -> /~chrismcc/mytest.php/HERE/THERE&EVERYWHERE 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (3) applying pattern '(.+)\.php/(.+)/(.+)' to uri '/~chrismcc/mytest.php/HERE/THERE&EVERYWHERE' 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (2) rewrite /~chrismcc/mytest.php/HERE/THERE&EVERYWHERE -> /~chrismcc/mytest.php/HERE&THERE&EVERYWHERE 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (3) applying pattern '(.+)\.php/(.+)/(.+)' to uri '/~chrismcc/mytest.php/HERE&THERE&EVERYWHERE' 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (3) applying pattern '(.+)\.php/(.+)' to uri '/~chrismcc/mytest.php/HERE&THERE&EVERYWHERE' 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (2) rewrite /~chrismcc/mytest.php/HERE&THERE&EVERYWHERE -> /~chrismcc/mytest.php?HERE&THERE&EVERYWHERE 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (3) split uri=/~chrismcc/mytest.php?HERE&THERE&EVERYWHERE -> uri=/~chrismcc/mytest.php, args=HERE&THERE&EVERYWHERE 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (2) local path result: /home/chrismcc/mytest.php 24.8.138.101 - - [26/Apr/2001:07:23:16 -0700] [www1.pricegrabber.com/sid#809da90][rid#8214978/initial] (1) go-ahead with /home/chrismcc/mytest.php [OK] [chrismcc@www1 chrismcc]$ cat /etc/httpd/conf/include.d/_mytest.conf RewriteEngine on RewriteLog /var/log/httpd/rewrite.log RewriteLogLevel 3 RewriteCond %{REQUEST_URI} (.+)\.php/(.+) RewriteRule (.+)\.php/(.+)/(.+) $1.php/$2&$3 [N] RewriteRule (.+)\.php/(.+) $1.php?$2 DocumentRoot /www/pricegrabber.com/doc-root >How-To-Repeat: I'm not sure about other mod_rewrite rules, but this one breaks when using http://SITE/~username/FILE.php/HERE/THERE/EVERYWHERE The purpose of this rule is to rewrite /HERE/THERE/EVERYWHERE to ?HERE&THERE&EVERYWHERE so that php can parse the variables easily ( in production they would be HERE=something). In the site document root this works great. But in a user directory (/home/chrismcc/public_html/mytest.php) the 'public_html' gets dropped from the file path. ( local path result: /home/chrismcc/mytest.php ) >Fix: >Release-Note: >Audit-Trail: >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! ]