You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marc Boorshtein <mb...@yahoo.com> on 2003/04/14 23:16:49 UTC

[users@httpd] Stop ReWrite Infinite Loops?

Hello,

I am trying to setup some rewriting, but I can't get out of an infinite
loop.  Here are my rules:

RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
RewriteCond %{REQUEST_URI} !^/var/www/hosts
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^([^.]+)\.server\.com(.*) /var/www/hosts/%{HTTP_HOST}/docs
[L]


And the logs show this:
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8269bb8/initial] (1) go-ahead with
/var/www/hosts/mlb.server.com/docs [OK]
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) init rewrite engine
with requested uri
/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern
'^(.+)' to uri
'/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php'
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:
input='mlb.server.com' pattern='^[^.]+\.server\.com$' => matched
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:
input='/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php' pattern='!^/var/www/hosts' => matched
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite
/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php -> mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern
'^([^.]+)\.server\.com(.*)' to uri
'mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php'
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite
mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php -> /var/www/hosts/mlb.server.com/docs
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) local path result:
/var/www/hosts/mlb.server.com/docs
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (1) go-ahead with
/var/www/hosts/mlb.server.com/docs [OK]

I thought the REQUEST_URI is what I need to test.  Am I missing
something?
-- 
Marc Boorshtein <mb...@yahoo.com>

Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Marc Boorshtein <mb...@yahoo.com>.
Right, but here's the problem : REQUEST_URI keeps getting set to
/index.php/index.php/index.php/....

I thought REQUEST_URI should endup as /path/on/system?  Is this a
problem with apache on redhat 8?  I'm almost positive this worked fine a
little while ago before my last round of updates.  When the rewrite is
complete, what can I use to test the final result of a RewriteRule?  can
I set the result to an environment variable and test that?

Thanks
Marc

On Tue, 2003-04-15 at 02:11, Andrea Rossignoli wrote:
> Hi,
> 
> >I am trying to setup some rewriting, but I can't get out of an infinite
> >loop.  Here are my rules:
> >
> >RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> >RewriteCond %{REQUEST_URI} !^/var/www/hosts
> >RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
> >RewriteRule   ^([^.]+)\.server\.com(.*) /var/www/hosts/%{HTTP_HOST}/docs
> [L]
> 
> If I'm right you want that every request to a subdomain is redirected to a
> particular directory.
> So put this code into an .htaccess or inside a directory block of your
> document root into your httpd.conf
> 
> RewriteEngine On
> 
> # Extract the subdomain from the host name
> RewriteCond %{HTTP_HOST} ^([^.]+)\.server\.com$ [NC]
> # Verify that it's not www because it's the main server
> RewriteCond %1 !^www$ [NC]
> # Verify that an internal request was not in progress
> RewriteCond %{REQUEST_URI} !^/var/www/hosts [NC]
> # Okay, finally make the redirection
> RewriteRule (.*) /var/www/hosts/%1/docs/$1 [L]
> 
> Remember that /var/www/hosts/etcetc is not an absolute directory path,
> but it's relative to your document root.
> 
> Maybe it should be possible to do the same thing with some virtual host
> directives,
> but you asked for mod_rewrite and I showed an example.
> 
> Hope it helped,
> 
> Thank you,
> :-) Andrea
> 
> 
> ----- Original Message -----
> From: "Marc Boorshtein" <mb...@yahoo.com>
> To: <us...@httpd.apache.org>
> Sent: Monday, April 14, 2003 23:16
> Subject: [users@httpd] Stop ReWrite Infinite Loops?
> 
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
-- 
Marc Boorshtein <mb...@yahoo.com>

Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Andrea Rossignoli <so...@polin.it>.
Hi,

>I am trying to setup some rewriting, but I can't get out of an infinite
>loop.  Here are my rules:
>
>RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
>RewriteCond %{REQUEST_URI} !^/var/www/hosts
>RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
>RewriteRule   ^([^.]+)\.server\.com(.*) /var/www/hosts/%{HTTP_HOST}/docs
[L]

If I'm right you want that every request to a subdomain is redirected to a
particular directory.
So put this code into an .htaccess or inside a directory block of your
document root into your httpd.conf

RewriteEngine On

# Extract the subdomain from the host name
RewriteCond %{HTTP_HOST} ^([^.]+)\.server\.com$ [NC]
# Verify that it's not www because it's the main server
RewriteCond %1 !^www$ [NC]
# Verify that an internal request was not in progress
RewriteCond %{REQUEST_URI} !^/var/www/hosts [NC]
# Okay, finally make the redirection
RewriteRule (.*) /var/www/hosts/%1/docs/$1 [L]

Remember that /var/www/hosts/etcetc is not an absolute directory path,
but it's relative to your document root.

Maybe it should be possible to do the same thing with some virtual host
directives,
but you asked for mod_rewrite and I showed an example.

Hope it helped,

Thank you,
:-) Andrea


----- Original Message -----
From: "Marc Boorshtein" <mb...@yahoo.com>
To: <us...@httpd.apache.org>
Sent: Monday, April 14, 2003 23:16
Subject: [users@httpd] Stop ReWrite Infinite Loops?



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

the PT flag for the RewriteRule might work.
They said they will change this in Apach 2, but I don't know if they
did.

Jurgen


On 15 Apr 2003 17:47:43 -0400
Marc Boorshtein <mb...@yahoo.com> wrote:

> when i do a rewrite it goes to a physical path
> (user.server.com/tomcatdir ---> 
> /var/www/hosts/user.server.com/tomcatid).  How can i get it to map
> someuser.server.com/tomcatdir to map to the mounted location?
> 
> marc
> 
> On Tue, 2003-04-15 at 14:04, Jurgen wrote:
> > Hi,
> > 
> > you will have to say something like
> >   JkMount /servlets ajp13
> > and/or
> >   JkMount *.jsp ajp13
> > and leave the rest to Jakarta.
> > You can create a <Host> for each subdomain, but you will need at
least a> > <Context> for each of them unless you want them to point all
to the same> > directory.
> > 
> > Jurgen
> > 
> > 
> > On 15 Apr 2003 14:52:07 -0400
> > Marc Boorshtein <mb...@yahoo.com> wrote:
> > 
> > > Thanks, that worked!  Now I have one last thing to figure out, how
do> > I> use mounted locations?  I am using jakarta and I need each
subdomin> > to> have access to the mounted directory?
> > > 
> > > Thanks
> > > Marc
> > > 
> > > On Tue, 2003-04-15 at 11:28, Jurgen wrote:
> > > > Hi,
> > > > 
> > > > you are trying to stop the looping by this statement:
> > > >   RewriteCond %{REQUEST_URI} !^/var/www/hosts
> > > > This will not work, because the REQUEST_URI will not become
> > > > /var/www/hosts. As you can see in the logs it becomes a row of
> > > > index.php's. As you don't know what else you can get beside the
> > > > index.php's you can't depend on the REQUEST_URI to stop the
looping.> > > > 
> > > > How about this?
> > > > 
> > > > RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> > > > RewriteRule ^(.+)       /var/www/hosts/%{HTTP_HOST}/docs/$1
> > > > 
> > > > This simply checks if the domain is a subdomain and rewrites it
to a> > > > local path. If this is not what you are looking for describe
for> > which> > purpose this doesn't work.
> > > > 
> > > > The REQUEST_URI is what you see in the browsers location bar
right> > after> > the domain name or at least a /
> > > > 
> > > > Jurgen
> > > > 
> > > > 
> > > > On 14 Apr 2003 17:16:49 -0400
> > > > Marc Boorshtein <mb...@yahoo.com> wrote:
> > > > 
> > > > > Hello,
> > > > > 
> > > > > I am trying to setup some rewriting, but I can't get out of an
> > > > infinite> loop.  Here are my rules:
> > > > > 
> > > > > RewriteCond   %{HTTP_HOST}                
^[^.]+\.server\.com$> > > > > RewriteCond %{REQUEST_URI}
!^/var/www/hosts> > > > > RewriteRule   ^(.+)                       
%{HTTP_HOST}$1         > > [C]> > > RewriteRule  
^([^.]+)\.server\.com(.*)> > > > /var/www/hosts/%{HTTP_HOST}/docs> [L]
> > > > > 
> > > > > 
> > > > > And the logs show this:
> > > > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > > > [mlb.server.com/sid#809ceb0][rid#8269bb8/initial] (1) go-ahead
> > with> > > /var/www/hosts/mlb.server.com/docs [OK]
> > > > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > > > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) init
rewrite> > > > engine> with requested uri
> > > > >
> > > >

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Marc Boorshtein <mb...@yahoo.com>.
when i do a rewrite it goes to a physical path
(user.server.com/tomcatdir ---> 
/var/www/hosts/user.server.com/tomcatid).  How can i get it to map
someuser.server.com/tomcatdir to map to the mounted location?

marc

On Tue, 2003-04-15 at 14:04, Jurgen wrote:
> Hi,
> 
> you will have to say something like
>   JkMount /servlets ajp13
> and/or
>   JkMount *.jsp ajp13
> and leave the rest to Jakarta.
> You can create a <Host> for each subdomain, but you will need at least a
> <Context> for each of them unless you want them to point all to the same
> directory.
> 
> Jurgen
> 
> 
> On 15 Apr 2003 14:52:07 -0400
> Marc Boorshtein <mb...@yahoo.com> wrote:
> 
> > Thanks, that worked!  Now I have one last thing to figure out, how do
> I> use mounted locations?  I am using jakarta and I need each subdomin
> to> have access to the mounted directory?
> > 
> > Thanks
> > Marc
> > 
> > On Tue, 2003-04-15 at 11:28, Jurgen wrote:
> > > Hi,
> > > 
> > > you are trying to stop the looping by this statement:
> > >   RewriteCond %{REQUEST_URI} !^/var/www/hosts
> > > This will not work, because the REQUEST_URI will not become
> > > /var/www/hosts. As you can see in the logs it becomes a row of
> > > index.php's. As you don't know what else you can get beside the
> > > index.php's you can't depend on the REQUEST_URI to stop the looping.
> > > 
> > > How about this?
> > > 
> > > RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> > > RewriteRule ^(.+)       /var/www/hosts/%{HTTP_HOST}/docs/$1
> > > 
> > > This simply checks if the domain is a subdomain and rewrites it to a
> > > local path. If this is not what you are looking for describe for
> which> > purpose this doesn't work.
> > > 
> > > The REQUEST_URI is what you see in the browsers location bar right
> after> > the domain name or at least a /
> > > 
> > > Jurgen
> > > 
> > > 
> > > On 14 Apr 2003 17:16:49 -0400
> > > Marc Boorshtein <mb...@yahoo.com> wrote:
> > > 
> > > > Hello,
> > > > 
> > > > I am trying to setup some rewriting, but I can't get out of an
> > > infinite> loop.  Here are my rules:
> > > > 
> > > > RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> > > > RewriteCond %{REQUEST_URI} !^/var/www/hosts
> > > > RewriteRule   ^(.+)                        %{HTTP_HOST}$1         
> [C]> > > RewriteRule   ^([^.]+)\.server\.com(.*)
> > > /var/www/hosts/%{HTTP_HOST}/docs> [L]
> > > > 
> > > > 
> > > > And the logs show this:
> > > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > > [mlb.server.com/sid#809ceb0][rid#8269bb8/initial] (1) go-ahead
> with> > > /var/www/hosts/mlb.server.com/docs [OK]
> > > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) init rewrite
> > > engine> with requested uri
> > > >
> > >
> /index.php/index.php/index.php/index.php/index.php/index.php/index.php/>
> > index.php/index.php/index.php/index.php> 127.0.0.1 - -> >
> [14/Apr/2003:17:06:32 --0400]>> >
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>>
> > '^(.+)' to uri>> >
> '/index.php/index.php/index.php/index.php/index.php/index.php/index.php>
> > /index.php/index.php/index.php/index.php'> 127.0.0.1 - -> >
> [14/Apr/2003:17:06:32 --0400]>> >
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>> >
> input='mlb.server.com' pattern='^[^.]+\.server\.com$' => matched>> >
> 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]>> >
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>> >
> input='/index.php/index.php/index.php/index.php/index.php/index.php/ind>
> > ex.php/index.php/index.php/index.php/index.php'> >
> pattern='!^/var/www/hosts' => matched> 127.0.0.1 - -> >
> [14/Apr/2003:17:06:32 --0400]>> >
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>> >
> /index.php/index.php/index.php/index.php/index.php/index.php/index.php/>
> > index.php/index.php/index.php/index.php ->> >
> mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.>
> > php/index.php/index.php/index.php/index.php/index.php> 127.0.0.1 - ->
> > [14/Apr/2003:17:06:32 --0400]>> >
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>>
> > '^([^.]+)\.server\.com(.*)' to uri>> >
> 'mlb.server.com/index.php/index.php/index.php/index.php/index.php/index>
> > .php/index.php/index.php/index.php/index.php/index.php'> 127.0.0.1 -
> -> > [14/Apr/2003:17:06:32 --0400]>> >
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>> >
> mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.>
> > php/index.php/index.php/index.php/index.php/index.php ->> >
> /var/www/hosts/mlb.server.com/docs> 127.0.0.1 - - [14/Apr/2003:17:06:32>
> > --0400]> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) local
> path> > result:> /var/www/hosts/mlb.server.com/docs
> > > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (1) go-ahead with
> > > > /var/www/hosts/mlb.server.com/docs [OK]
> > > > 
> > > > I thought the REQUEST_URI is what I need to test.  Am I missing
> > > > something?
> > > > -- 
> > > > Marc Boorshtein <mb...@yahoo.com>
> > > > 
> > > 
> > >
> ---------------------------------------------------------------------> >
> The official User-To-User support forum of the Apache HTTP Server
> Project.> > See <URL:http://httpd.apache.org/userslist.html> for more
> info.> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > -- 
> > Marc Boorshtein <mb...@yahoo.com>
> > 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
-- 
Marc Boorshtein <mb...@yahoo.com>

Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

you will have to say something like
  JkMount /servlets ajp13
and/or
  JkMount *.jsp ajp13
and leave the rest to Jakarta.
You can create a <Host> for each subdomain, but you will need at least a
<Context> for each of them unless you want them to point all to the same
directory.

Jurgen


On 15 Apr 2003 14:52:07 -0400
Marc Boorshtein <mb...@yahoo.com> wrote:

> Thanks, that worked!  Now I have one last thing to figure out, how do
I> use mounted locations?  I am using jakarta and I need each subdomin
to> have access to the mounted directory?
> 
> Thanks
> Marc
> 
> On Tue, 2003-04-15 at 11:28, Jurgen wrote:
> > Hi,
> > 
> > you are trying to stop the looping by this statement:
> >   RewriteCond %{REQUEST_URI} !^/var/www/hosts
> > This will not work, because the REQUEST_URI will not become
> > /var/www/hosts. As you can see in the logs it becomes a row of
> > index.php's. As you don't know what else you can get beside the
> > index.php's you can't depend on the REQUEST_URI to stop the looping.
> > 
> > How about this?
> > 
> > RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> > RewriteRule ^(.+)       /var/www/hosts/%{HTTP_HOST}/docs/$1
> > 
> > This simply checks if the domain is a subdomain and rewrites it to a
> > local path. If this is not what you are looking for describe for
which> > purpose this doesn't work.
> > 
> > The REQUEST_URI is what you see in the browsers location bar right
after> > the domain name or at least a /
> > 
> > Jurgen
> > 
> > 
> > On 14 Apr 2003 17:16:49 -0400
> > Marc Boorshtein <mb...@yahoo.com> wrote:
> > 
> > > Hello,
> > > 
> > > I am trying to setup some rewriting, but I can't get out of an
> > infinite> loop.  Here are my rules:
> > > 
> > > RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> > > RewriteCond %{REQUEST_URI} !^/var/www/hosts
> > > RewriteRule   ^(.+)                        %{HTTP_HOST}$1         
[C]> > > RewriteRule   ^([^.]+)\.server\.com(.*)
> > /var/www/hosts/%{HTTP_HOST}/docs> [L]
> > > 
> > > 
> > > And the logs show this:
> > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > [mlb.server.com/sid#809ceb0][rid#8269bb8/initial] (1) go-ahead
with> > > /var/www/hosts/mlb.server.com/docs [OK]
> > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) init rewrite
> > engine> with requested uri
> > >
> >
/index.php/index.php/index.php/index.php/index.php/index.php/index.php/>
> index.php/index.php/index.php/index.php> 127.0.0.1 - -> >
[14/Apr/2003:17:06:32 --0400]>> >
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>>
> '^(.+)' to uri>> >
'/index.php/index.php/index.php/index.php/index.php/index.php/index.php>
> /index.php/index.php/index.php/index.php'> 127.0.0.1 - -> >
[14/Apr/2003:17:06:32 --0400]>> >
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>> >
input='mlb.server.com' pattern='^[^.]+\.server\.com$' => matched>> >
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]>> >
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>> >
input='/index.php/index.php/index.php/index.php/index.php/index.php/ind>
> ex.php/index.php/index.php/index.php/index.php'> >
pattern='!^/var/www/hosts' => matched> 127.0.0.1 - -> >
[14/Apr/2003:17:06:32 --0400]>> >
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>> >
/index.php/index.php/index.php/index.php/index.php/index.php/index.php/>
> index.php/index.php/index.php/index.php ->> >
mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.>
> php/index.php/index.php/index.php/index.php/index.php> 127.0.0.1 - ->
> [14/Apr/2003:17:06:32 --0400]>> >
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>>
> '^([^.]+)\.server\.com(.*)' to uri>> >
'mlb.server.com/index.php/index.php/index.php/index.php/index.php/index>
> .php/index.php/index.php/index.php/index.php/index.php'> 127.0.0.1 -
-> > [14/Apr/2003:17:06:32 --0400]>> >
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>> >
mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.>
> php/index.php/index.php/index.php/index.php/index.php ->> >
/var/www/hosts/mlb.server.com/docs> 127.0.0.1 - - [14/Apr/2003:17:06:32>
> --0400]> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) local
path> > result:> /var/www/hosts/mlb.server.com/docs
> > > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (1) go-ahead with
> > > /var/www/hosts/mlb.server.com/docs [OK]
> > > 
> > > I thought the REQUEST_URI is what I need to test.  Am I missing
> > > something?
> > > -- 
> > > Marc Boorshtein <mb...@yahoo.com>
> > > 
> > 
> >
---------------------------------------------------------------------> >
The official User-To-User support forum of the Apache HTTP Server
Project.> > See <URL:http://httpd.apache.org/userslist.html> for more
info.> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> -- 
> Marc Boorshtein <mb...@yahoo.com>
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Marc Boorshtein <mb...@yahoo.com>.
Thanks, that worked!  Now I have one last thing to figure out, how do I
use mounted locations?  I am using jakarta and I need each subdomin to
have access to the mounted directory?

Thanks
Marc

On Tue, 2003-04-15 at 11:28, Jurgen wrote:
> Hi,
> 
> you are trying to stop the looping by this statement:
>   RewriteCond %{REQUEST_URI} !^/var/www/hosts
> This will not work, because the REQUEST_URI will not become
> /var/www/hosts. As you can see in the logs it becomes a row of
> index.php's. As you don't know what else you can get beside the
> index.php's you can't depend on the REQUEST_URI to stop the looping.
> 
> How about this?
> 
> RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> RewriteRule ^(.+)       /var/www/hosts/%{HTTP_HOST}/docs/$1
> 
> This simply checks if the domain is a subdomain and rewrites it to a
> local path. If this is not what you are looking for describe for which
> purpose this doesn't work.
> 
> The REQUEST_URI is what you see in the browsers location bar right after
> the domain name or at least a /
> 
> Jurgen
> 
> 
> On 14 Apr 2003 17:16:49 -0400
> Marc Boorshtein <mb...@yahoo.com> wrote:
> 
> > Hello,
> > 
> > I am trying to setup some rewriting, but I can't get out of an
> infinite> loop.  Here are my rules:
> > 
> > RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> > RewriteCond %{REQUEST_URI} !^/var/www/hosts
> > RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
> > RewriteRule   ^([^.]+)\.server\.com(.*)
> /var/www/hosts/%{HTTP_HOST}/docs> [L]
> > 
> > 
> > And the logs show this:
> > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > [mlb.server.com/sid#809ceb0][rid#8269bb8/initial] (1) go-ahead with
> > /var/www/hosts/mlb.server.com/docs [OK]
> > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) init rewrite
> engine> with requested uri
> >
> /index.php/index.php/index.php/index.php/index.php/index.php/index.php/
> index.php/index.php/index.php/index.php> 127.0.0.1 - -
> [14/Apr/2003:17:06:32 --0400]>
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>
> '^(.+)' to uri>
> '/index.php/index.php/index.php/index.php/index.php/index.php/index.php
> /index.php/index.php/index.php/index.php'> 127.0.0.1 - -
> [14/Apr/2003:17:06:32 --0400]>
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>
> input='mlb.server.com' pattern='^[^.]+\.server\.com$' => matched>
> 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]>
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>
> input='/index.php/index.php/index.php/index.php/index.php/index.php/ind
> ex.php/index.php/index.php/index.php/index.php'
> pattern='!^/var/www/hosts' => matched> 127.0.0.1 - -
> [14/Apr/2003:17:06:32 --0400]>
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>
> /index.php/index.php/index.php/index.php/index.php/index.php/index.php/
> index.php/index.php/index.php/index.php ->
> mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.
> php/index.php/index.php/index.php/index.php/index.php> 127.0.0.1 - -
> [14/Apr/2003:17:06:32 --0400]>
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>
> '^([^.]+)\.server\.com(.*)' to uri>
> 'mlb.server.com/index.php/index.php/index.php/index.php/index.php/index
> .php/index.php/index.php/index.php/index.php/index.php'> 127.0.0.1 - -
> [14/Apr/2003:17:06:32 --0400]>
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>
> mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.
> php/index.php/index.php/index.php/index.php/index.php ->
> /var/www/hosts/mlb.server.com/docs> 127.0.0.1 - - [14/Apr/2003:17:06:32
> --0400]> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) local path
> result:> /var/www/hosts/mlb.server.com/docs
> > 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> > [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (1) go-ahead with
> > /var/www/hosts/mlb.server.com/docs [OK]
> > 
> > I thought the REQUEST_URI is what I need to test.  Am I missing
> > something?
> > -- 
> > Marc Boorshtein <mb...@yahoo.com>
> > 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
-- 
Marc Boorshtein <mb...@yahoo.com>

Re: [users@httpd] Stop ReWrite Infinite Loops?

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

you are trying to stop the looping by this statement:
  RewriteCond %{REQUEST_URI} !^/var/www/hosts
This will not work, because the REQUEST_URI will not become
/var/www/hosts. As you can see in the logs it becomes a row of
index.php's. As you don't know what else you can get beside the
index.php's you can't depend on the REQUEST_URI to stop the looping.

How about this?

RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
RewriteRule ^(.+)       /var/www/hosts/%{HTTP_HOST}/docs/$1

This simply checks if the domain is a subdomain and rewrites it to a
local path. If this is not what you are looking for describe for which
purpose this doesn't work.

The REQUEST_URI is what you see in the browsers location bar right after
the domain name or at least a /

Jurgen


On 14 Apr 2003 17:16:49 -0400
Marc Boorshtein <mb...@yahoo.com> wrote:

> Hello,
> 
> I am trying to setup some rewriting, but I can't get out of an
infinite> loop.  Here are my rules:
> 
> RewriteCond   %{HTTP_HOST}                 ^[^.]+\.server\.com$
> RewriteCond %{REQUEST_URI} !^/var/www/hosts
> RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
> RewriteRule   ^([^.]+)\.server\.com(.*)
/var/www/hosts/%{HTTP_HOST}/docs> [L]
> 
> 
> And the logs show this:
> 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> [mlb.server.com/sid#809ceb0][rid#8269bb8/initial] (1) go-ahead with
> /var/www/hosts/mlb.server.com/docs [OK]
> 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) init rewrite
engine> with requested uri
>
/index.php/index.php/index.php/index.php/index.php/index.php/index.php/
index.php/index.php/index.php/index.php> 127.0.0.1 - -
[14/Apr/2003:17:06:32 --0400]>
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>
'^(.+)' to uri>
'/index.php/index.php/index.php/index.php/index.php/index.php/index.php
/index.php/index.php/index.php/index.php'> 127.0.0.1 - -
[14/Apr/2003:17:06:32 --0400]>
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>
input='mlb.server.com' pattern='^[^.]+\.server\.com$' => matched>
127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]>
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (4) RewriteCond:>
input='/index.php/index.php/index.php/index.php/index.php/index.php/ind
ex.php/index.php/index.php/index.php/index.php'
pattern='!^/var/www/hosts' => matched> 127.0.0.1 - -
[14/Apr/2003:17:06:32 --0400]>
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>
/index.php/index.php/index.php/index.php/index.php/index.php/index.php/
index.php/index.php/index.php/index.php ->
mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.
php/index.php/index.php/index.php/index.php/index.php> 127.0.0.1 - -
[14/Apr/2003:17:06:32 --0400]>
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (3) applying pattern>
'^([^.]+)\.server\.com(.*)' to uri>
'mlb.server.com/index.php/index.php/index.php/index.php/index.php/index
.php/index.php/index.php/index.php/index.php/index.php'> 127.0.0.1 - -
[14/Apr/2003:17:06:32 --0400]>
[mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) rewrite>
mlb.server.com/index.php/index.php/index.php/index.php/index.php/index.
php/index.php/index.php/index.php/index.php/index.php ->
/var/www/hosts/mlb.server.com/docs> 127.0.0.1 - - [14/Apr/2003:17:06:32
--0400]> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (2) local path
result:> /var/www/hosts/mlb.server.com/docs
> 127.0.0.1 - - [14/Apr/2003:17:06:32 --0400]
> [mlb.server.com/sid#809ceb0][rid#8275be8/subreq] (1) go-ahead with
> /var/www/hosts/mlb.server.com/docs [OK]
> 
> I thought the REQUEST_URI is what I need to test.  Am I missing
> something?
> -- 
> Marc Boorshtein <mb...@yahoo.com>
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org