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 2006/07/11 01:20:28 UTC

DO NOT REPLY [Bug 40004] New: - Mod_rewrite 'Last' flag doesn't seem to end rewriting

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=40004>.
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=40004

           Summary: Mod_rewrite 'Last' flag doesn't seem to end rewriting
           Product: Apache httpd-2
           Version: 2.2.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: mod_rewrite
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: pfudd@ubc.pkts.ca


I have two rules:
    RewriteBase /db/
    RewriteRule ^experiment-1 experiment-2 [L]
    RewriteRule ^experiment-2 experiment-3

The url http://localhost/db/experiment-1 should be rewritten to experiment-2,
and that should be the last rewriting to be done.  However, the actual file
retrieved is experiment-3.

The output of rewritelog (at level 2) is:
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa45668/initial] (2) init rewrite engine with
requested uri /db/experiment-1
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa45668/initial] (1) pass through /db/experiment-1
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa45668/initial] (2) [perdir /var/www/html/db/]
rewrite 'experiment-1' -> 'experiment-2'
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa45668/initial] (2) [perdir /var/www/html/db/]
trying to replace prefix /var/www/html/db/ with /db/
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa45668/initial] (1) [perdir /var/www/html/db/]
internal redirect with /db/experiment-2 [INTERNAL REDIRECT]
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4a040/initial/redir#1] (2) init rewrite engine
with requested uri /db/experiment-2
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4a040/initial/redir#1] (1) pass through
/db/experiment-2
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4a040/initial/redir#1] (2) [perdir
/var/www/html/db/] rewrite 'experiment-2' -> 'experiment-3'
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4a040/initial/redir#1] (2) [perdir
/var/www/html/db/] trying to replace prefix /var/www/html/db/ with /db/
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4a040/initial/redir#1] (1) [perdir
/var/www/html/db/] internal redirect with /db/experiment-3 [INTERNAL REDIRECT]
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4bcb8/initial/redir#2] (2) init rewrite engine
with requested uri /db/experiment-3
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4bcb8/initial/redir#2] (1) pass through
/db/experiment-3
127.0.0.1 - - [10/Jul/2006:16:07:25 --0700]
[localhost/sid#989a608][rid#aa4bcb8/initial/redir#2] (1) [perdir
/var/www/html/db/] pass through /var/www/html/db/experiment-3

I don't know what [L] is supposed to do, if this is correct behaviour.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004


nd@perlig.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
          Component|mod_rewrite                 |Documentation
         Resolution|INVALID                     |




------- Additional Comments From nd@perlig.de  2006-07-12 07:39 -------
It's kinda documented, but too implicit and so quite bad. The place for such
requests is here ;)
You can also place patches here or enter the docs list
(http://httpd.apache.org/docs-project/) :-)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From robsiegen@googlemail.com  2006-07-13 10:41 -------
(In reply to comment #8)
> The more I think about it, the more I think this is a misfeature.  If '[L]'
> doesn't stop further rewriting (in directory rules), then it doesn't serve a
> purpose (in directory rules).

Well, as  Andr� said, it stops processing in that round of processing. The
internal redirect is nearly a new request (well, not everything is being
re-processed). The L-Flag is usefull in per-dir context, just think about 20
rules and the first did match. With out the L-flag everything below would be
tested in that round of processing, too. That saves processing. I don't think
that writing something like "don't apply rewrite rules any more" into
request_rec is a solution, think about the situation rewriting /a to /b while
there are rewriteRules in palce fpr <directory /var/www/b>.

> Is there a workaround?

Either use THE_REQUEST or ENV:REDIRECT_STATUS

    RewriteBase /db/
    RewriteRule ^experiment-1 experiment-2 [L]
    RewriteCond %{ENV:REDIRECT_STATUS} =""
    RewriteRule ^experiment-2 experiment-3

or

    RewriteBase /db/
    RewriteRule ^experiment-1 experiment-2 [L]
    RewriteCond %{THE_REQUEST} experiment-2
    RewriteRule ^experiment-2 experiment-3

> The new rewrite flags documentation (httpd.apache.org/docs/rewrite/flags.html)

There is a small mistake:
RewriteRule %{REQUEST_URI} \.(png|gif|jpg) - [E=image:1]

should be

RewriteRule \.(png|gif|jpg) - [E=image:1]

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From pfudd@ubc.pkts.ca  2006-07-11 16:04 -------
Well, as my teacher used to say, it's either a bug in the program or a bug in
the documentation.  This behaviour isn't documented; who do I send requests like
this to?

Thanks!

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From pfudd@ubc.pkts.ca  2006-07-11 17:30 -------
If someone updates the RewriteEngine documentation, some of the points from
http://www.sitepoint.com/print/mod_rewrite-no-endless-loops would be good to
include.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004


rbowen@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED




------- Additional Comments From rbowen@apache.org  2006-07-12 10:47 -------
The new rewrite flags documentation (httpd.apache.org/docs/rewrite/flags.html)
will be providing more detail on things like this. I'll be certain to cover this
particular annoyance there. Thanks for the reminder.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004


nd@perlig.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From nd@perlig.de  2006-07-11 05:44 -------
Yes. That was obvious from the description and the rewrite log. ;-)

The [L] flag works as expected (finishing the Ruleset). What you probably didn't
expect was that the internal redirect finds the whole ruleset again and again.
That's a different issue and a side effect of RewriteRules in the directory context.

-> invalid.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From rbowen@apache.org  2007-07-25 08:39 -------
(In reply to comment #9)

> There is a small mistake:
> RewriteRule %{REQUEST_URI} \.(png|gif|jpg) - [E=image:1]
> 
> should be
> 
> RewriteRule \.(png|gif|jpg) - [E=image:1]

Thanks. Fixed in r559494 in trunk. Will fix in 2.2 also.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From pfudd@ubc.pkts.ca  2006-07-10 23:41 -------
These rules are inside a <Directory /var/www/html/db> section, if that helps.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From pfudd@ubc.pkts.ca  2006-07-12 16:57 -------
The more I think about it, the more I think this is a misfeature.  If '[L]'
doesn't stop further rewriting (in directory rules), then it doesn't serve a
purpose (in directory rules).  Is there a workaround?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004


slive@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From slive@apache.org  2007-08-01 11:49 -------
Fixed on trunk to note the reinjection possibility in the docs for the L flag.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40004] - Mod_rewrite 'Last' flag doesn't seem to end rewriting

Posted by bu...@apache.org.
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=40004>.
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=40004





------- Additional Comments From kernel@pkts.ca  2006-07-12 07:47 -------
I'd love to supply a patch, but I don't know enough about what's going on to
write one for this.  I'd be supplying some 'G' for the GIGO process.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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