httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jurgen <apa...@squarehosting.com>
Subject Re: [users@httpd] Stop ReWrite Infinite Loops?
Date Tue, 15 Apr 2003 15:28:17 GMT
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 <mboorshtein@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 <mboorshtein@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


Mime
View raw message