You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2004/10/25 16:05:54 UTC

DO NOT REPLY [Bug 31880] New: - 'last' (L) DIRECTIVE NOT WORKING FOR MOD REWRITE

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31880>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31880

'last' (L) DIRECTIVE NOT WORKING FOR MOD REWRITE

           Summary: 'last' (L) DIRECTIVE NOT WORKING FOR MOD REWRITE
           Product: Apache httpd-2.0
           Version: 2.0.52
          Platform: All
        OS/Version: FreeBSD
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: mod_rewrite
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: john@oceanebi.com
                CC: john@oceanebi.com


Hi,

I have a rewrite rule working in V1 apache that does not work in V2.  When I 
narrowed it down, I found out that the 'last' directive was letting my rewrite 
fall down through the rewrite commands all over again.

Here is the code:

AddHandler cgi-script .cgi
Options +ExecCGI

RewriteEngine on
SetEnv PS_SITE_CODE svg 
SetEnv PS_TOUR_CODE t1
SetEnv PS_PROC_ID PAYCOM 
SetEnv PS_CASCADE PAYCOM|CCBILL|PAYCOM|ELECTRA

RewriteBase /

# Take care of urls without trailing slashes
RewriteRule ^([^/]+/)*[^=]*=[^/]*$ /t1/$0/ [R,L]

# Take care of urls with a program listed but no affiliate
RewriteRule ^(([^/]+/)*[^=]*)=((/.*)?)$ /t1/$1=NoAdvert$3 [R,L]

# Take care of REVS program with affiliate id passed
RewriteRule ^(([^/]+/)*)REVS=([^/]+)(/(.*))?$ /t1/$1$5 
[L,NC,E=PSID:$3,E=PRGID:REVS,E=POPUP:NO,E=TBACK:NO]

# Take care of old, disabled, or improper program links
#  with affiliate id passed.  Rewrite to default program
RewriteRule ^(([^/]+/)*)[^=]*=([^/]+(/.*)?)$ /t1/$1revs=$3 [R,L]

# Take care of links without program or affiliate id passed.  
#  Rewrite to default program and NoAdvert
RewriteRule ^(([^/=]+/)*)([^/=]*)$ /t1/$1revs=NoAdvert/$3 [R,L]

The third line RewriteRule line is the culprit where the 'last' L directive 
does not work.

To test it, place it in a directory called 't1' under htdocs, and create an 
index.html file in that direcdtory.  Under apache V1 the following URL works:

http://www.sitename.com/t1/revs=sooper/index.html

but under V2, it falls through to the last RewriteRule and enters an infinite 
loop.  I thought the last command would stop the Rewrite processing.

Please advise if this is a logic error.  Otherwise, please fix this...it is an 
important piece of our software and Apache.


John Suprock
CastleComm
john@oceanebi.com
410 296 5970 (Ext 14)

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org