[buug] mod_rewrite apache

Stefan Lasiewski flarg at flarg.org
Wed Jul 7 10:51:55 PDT 2004


Hm, I thought the [L] would prevent loops...

-= Stefan

--- johnd <john at jjdev.com> wrote:
> this causes an endless loop, because you are using R and redirecting
> back to the server...and it keeps doing that in a loop
> 
> On Thu, Jul 01, 2004 at 10:30:53PM -0700, Stefan Lasiewski wrote:
> > It's been a while, but...
> > 
> > It looks like multiple rules are being applied to one request, which is
> why
> > you may want to use the [L] (Stop processing) flag. I think you might
> want to
> > use the 'Redirect, stop processing' flags, like this:
> > 
> > RewriteRule /(.*) /c2d/$1    [R,L]
> > 
> > Also, if you use /(.*) as a pattern, I think the rule will apply to 
> > 'foo.com/bar' but not 'foo.com/' because the pattern is looking for '/',
> > followed by 1 or more characters (.*). Maybe you want this instead?
> > 
> > RewriteRule ^(.*) /c2d/$1    [R,L]
> > 
> > Also, it's not clear from the log below: What URLs did you try, and did
> any
> > of them work? 
> > 
> > -= Stefan
> > 
> > --- johnd <john at jjdev.com> wrote:
> > > Anyone see a problem with this?
> > > 
> > > 
> > > I'm trying to have c2d/ prepending on all URLs
> > > 
> > > 
> > > ie: they type   http://foo.com/   change to: http://foo.com/bar/
> > > 
> > > 
> > > this is what I do in my apache conf file:
> > > 
> > > RewriteEngine On
> > > RewriteLog rewrite.log
> > > RewriteLogLevel 3
> > > RewriteRule /(.*) /c2d/$1
> > > 
> > > 
> > > rewrite log:
> > > 
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#813a3c8/initial] (
> > > 2) init rewrite engine with requested uri /
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#813a3c8/initial] (
> > > 3) applying pattern '/(.*)' to uri '/'
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#813a3c8/initial] (
> > > 2) rewrite / -> /c2d/
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#813a3c8/initial] (
> > > 2) local path result: /c2d/
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#813a3c8/initial] (
> > > 2) prefixed with document_root to /var/www/c2d/htdocs/c2d/
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#813a3c8/initial] (
> > > 1) go-ahead with /var/www/c2d/htdocs/c2d/ [OK]
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec50/subreq] (2
> > > ) init rewrite engine with requested uri /C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec50/subreq] (3
> > > ) applying pattern '/(.*)' to uri '/C2DControllerServlet'
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec50/subreq] (2
> > > ) rewrite /C2DControllerServlet -> /c2d/C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec50/subreq] (2
> > > ) local path result: /c2d/C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec50/subreq] (2
> > > ) prefixed with document_root to
> > > /var/www/c2d/htdocs/c2d/C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec50/subreq] (1
> > > ) go-ahead with /var/www/c2d/htdocs/c2d/C2DControllerServlet [OK]
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec28/initial/re
> > > dir#1] (2) init rewrite engine with requested uri /C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec28/initial/re
> > > dir#1] (3) applying pattern '/(.*)' to uri '/C2DControllerServlet'
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec28/initial/re
> > > dir#1] (2) rewrite /C2DControllerServlet -> /c2d/C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec28/initial/re
> > > dir#1] (2) local path result: /c2d/C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec28/initial/re
> > > dir#1] (2) prefixed with document_root to
> > > /var/www/c2d/htdocs/c2d/C2DControllerServlet
> > > 192.168.164.34 - - [01/Jul/2004:14:51:14 -0700]
> > > [privatestaging.connect2data.com/sid#80beaf8][rid#80cec28/initial/re
> > > dir#1] (1) go-ahead with /var/www/c2d/htdocs/c2d/C2DControllerServlet
> [OK]
> > > _______________________________________________
> > > Buug mailing list
> > > Buug at weak.org
> > > http://www.weak.org/mailman/listinfo/buug
> > > 
> > 
> > 
> > =====
> > ----
> > 'The art, or rather the knack
> > of flying is learning to throw
> > yourself to the ground and miss.'
> > -Douglas Adams, THGTTG
> > _______________________________________________
> > Buug mailing list
> > Buug at weak.org
> > http://www.weak.org/mailman/listinfo/buug
> _______________________________________________
> Buug mailing list
> Buug at weak.org
> http://www.weak.org/mailman/listinfo/buug
> 


=====
----
'The art, or rather the knack
of flying is learning to throw
yourself to the ground and miss.'
-Douglas Adams, THGTTG



More information about the buug mailing list