You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Gonzalez, Miguel" <mi...@threespot.com> on 2007/02/26 20:21:19 UTC

[users@httpd] rewrite rules

Dear all,

  I have Apache 2.0.54 on a Debian stable. I have what seems to be a
endless loop:

  mod_rewrite:
maximum number of internal redirects reached. Assuming configuration
error. Use 'RewriteOptions MaxRedirects' to increase the limit if
neccessary.

   the rules are:

   IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^/index\.php$
        RewriteCond %{REQUEST_URI} !^/.*\.html$
        RewriteCond %{REQUEST_URI} !^/test\.php$
        RewriteCond %{REQUEST_URI}
!(admin/|images/|includes/|scripts/|css/|flash/|tree/)

        RewriteRule ^([^/\.]+)(/(.*))?$ /tree/$3 [L,QSA]
#       RewriteRule (.*) /index.php [L]
</IfModule>

  I have read that there are some issues in the rules definitions that
could provoke an endless loop. But I am not an expert on writing these
rules and these ones where written by someone else. Any thoughts?

  Regards,

   Miguel

Miguel Gonzalez
Threespot | 3333 14th street NW | Suite 300 | Washington, DC 20010 
T: | F: 202.518.0425 | E: miguel.gonzalez@threespot.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] rewrite rules

Posted by "Gonzalez, Miguel" <mi...@threespot.com>.
Just I got this from the logs:

10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a1110/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] strip per-dir prefix: /var/www/mydomain.com/ ->
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a1110/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] applying pattern '^([^/\.]+)(/(.*))?$' to uri ''
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a1110/initial] (1) [per-dir /var/www/bcf01.dev.threespot
.com/] pass through /var/www/mydomain.com/
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a5120/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] strip per-dir prefix: /var/www/mydomain.com/404.php -> 404.php
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a5120/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] applying pattern '^([^/\.]+)(/(.*))?$' to uri '404.php'
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a5120/initial] (1) [per-dir /var/www/bcf01.dev.threespot
.com/] pass through /var/www/mydomain.com/404.php
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a3118/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] strip per-dir prefix: /var/www/mydomain.com/404.php -> 404.php
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a3118/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] applying pattern '^([^/\.]+)(/(.*))?$' to uri '404.php'
10.0.6.142 - - [26/Feb/2007:15:01:51 --0500] [mydomain.com/sid#81c69e0][rid#83a3118/initial] (1) [per-dir /var/www/bcf01.dev.threespot
.com/] pass through /var/www/mydomain.com/404.php
10.0.6.142 - - [26/Feb/2007:15:01:52 --0500] [mydomain.com/sid#81c69e0][rid#83a5120/initial] (3) [per-dir /var/www/bcf01.dev.threespot
.com/] strip per-dir prefix: /var/www/mydomain.com/404.php -> 404.php

I just try to get www.mydomain.com and I got a redirecting problem

Miguel


> -----Original Message-----
> From: matt farey [mailto:matt.farey@gmail.com]
> Sent: Monday, February 26, 2007 3:18 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] rewrite rules
> 
> What URL you are actually requesting? - there are a few that will, but
> that's ok provided you don't care about those.
> 
> Gonzalez, Miguel wrote:
> > Dear all,
> >
> >   I have Apache 2.0.54 on a Debian stable. I have what seems to be a
> > endless loop:
> >
> >   mod_rewrite:
> > maximum number of internal redirects reached. Assuming configuration
> > error. Use 'RewriteOptions MaxRedirects' to increase the limit if
> > neccessary.
> >
> >    the rules are:
> >
> >    IfModule mod_rewrite.c>
> >         RewriteEngine on
> >         RewriteCond %{REQUEST_URI} !^/index\.php$
> >         RewriteCond %{REQUEST_URI} !^/.*\.html$
> >         RewriteCond %{REQUEST_URI} !^/test\.php$
> >         RewriteCond %{REQUEST_URI}
> > !(admin/|images/|includes/|scripts/|css/|flash/|tree/)
> >
> >         RewriteRule ^([^/\.]+)(/(.*))?$ /tree/$3 [L,QSA]
> > #       RewriteRule (.*) /index.php [L]
> > </IfModule>
> >
> >   I have read that there are some issues in the rules definitions
> that
> > could provoke an endless loop. But I am not an expert on writing
> these
> > rules and these ones where written by someone else. Any thoughts?
> >
> >   Regards,
> >
> >    Miguel
> >
> > Miguel Gonzalez
> > Threespot | 3333 14th street NW | Suite 300 | Washington, DC 20010
> > T: | F: 202.518.0425 | E: miguel.gonzalez@threespot.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
> >
> >
> >
> 
> --
> Matthew Farey
> Web App Sec.
> 25 The Polygon, Southampton, Hants, SO15 2BP, UK
> Phone +44(0)2380 631449
> 
> 
> 
> ---------------------------------------------------------------------
> 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] rewrite rules

Posted by "Gonzalez, Miguel" <mi...@threespot.com>.
Of course there is an index.php :)

Many thanks

Miguel


Re: [users@httpd] rewrite rules

Posted by matt farey <ma...@gmail.com>.

Gonzalez, Miguel wrote:
> Sorry, it's not working I am getting on the logs:
>
>
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (3) [per-dir /var/www/mydomain.com/] add per-dir prefix: index.php -> /var/www/mydomain.com/index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (2) [per-dir /var/www/mydomain.com/] strip document_root prefix: /var/www/mydomain.com/index.php -> /index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (1) [per-dir /var/www/mydomain.com/] internal redirect with /index.php [INTERNAL REDIRECT]
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] strip per-dir prefix: /var/www/mydomain.com/index.php -> index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] applying pattern '^([^/\.]+)(/(.*))?$' to uri 'index.php'
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] strip per-dir prefix: /var/www/mydomain.com/index.php -> index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] applying pattern '(.*)' to uri 'index.php'
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (2) [per-dir /var/www/mydomain.com/] rewrite index.php -> index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] add per-dir prefix: index.php -> /var/www/mydomain.com/index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (1) [per-dir /var/www/mydomain.com/] initial URL equal rewritten URL: /var/www/mydomain.com/index.php [IGNORING REWRITE]
>
> Any ideas?
>
> Miguel
>   
or an index.php in your tree folder etc...

-- 
Matthew Farey




---------------------------------------------------------------------
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] rewrite rules

Posted by matt farey <ma...@gmail.com>.

Gonzalez, Miguel wrote:
> Sorry, it's not working I am getting on the logs:
>
>
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (3) [per-dir /var/www/mydomain.com/] add per-dir prefix: index.php -> /var/www/mydomain.com/index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (2) [per-dir /var/www/mydomain.com/] strip document_root prefix: /var/www/mydomain.com/index.php -> /index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (1) [per-dir /var/www/mydomain.com/] internal redirect with /index.php [INTERNAL REDIRECT]
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] strip per-dir prefix: /var/www/mydomain.com/index.php -> index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] applying pattern '^([^/\.]+)(/(.*))?$' to uri 'index.php'
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] strip per-dir prefix: /var/www/mydomain.com/index.php -> index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] applying pattern '(.*)' to uri 'index.php'
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (2) [per-dir /var/www/mydomain.com/] rewrite index.php -> index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] add per-dir prefix: index.php -> /var/www/mydomain.com/index.php
> 10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (1) [per-dir /var/www/mydomain.com/] initial URL equal rewritten URL: /var/www/mydomain.com/index.php [IGNORING REWRITE]
>
> Any ideas?
>
> Miguel
>   
all i can say is that i tested it before sending it to you, and it
worked but just needed tweaking slightly,
you could change [L] to [L,NS] or [PT] but i'm not sure still "what"
isn't working, I mean do you have an index.php on your server?

-- 
Matthew Farey



---------------------------------------------------------------------
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] rewrite rules

Posted by "Gonzalez, Miguel" <mi...@threespot.com>.
Sorry, it's not working I am getting on the logs:


10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (3) [per-dir /var/www/mydomain.com/] add per-dir prefix: index.php -> /var/www/mydomain.com/index.php
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (2) [per-dir /var/www/mydomain.com/] strip document_root prefix: /var/www/mydomain.com/index.php -> /index.php
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83a11d0/initial] (1) [per-dir /var/www/mydomain.com/] internal redirect with /index.php [INTERNAL REDIRECT]
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] strip per-dir prefix: /var/www/mydomain.com/index.php -> index.php
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] applying pattern '^([^/\.]+)(/(.*))?$' to uri 'index.php'
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] strip per-dir prefix: /var/www/mydomain.com/index.php -> index.php
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] applying pattern '(.*)' to uri 'index.php'
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (2) [per-dir /var/www/mydomain.com/] rewrite index.php -> index.php
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (3) [per-dir /var/www/mydomain.com/] add per-dir prefix: index.php -> /var/www/mydomain.com/index.php
10.0.6.221 - - [26/Feb/2007:16:06:02 --0500] [mydomain.com/sid#81c4370][rid#83ae630/initial/redir#1] (1) [per-dir /var/www/mydomain.com/] initial URL equal rewritten URL: /var/www/mydomain.com/index.php [IGNORING REWRITE]

Any ideas?

Miguel

Re: [users@httpd] rewrite rules

Posted by matt farey <ma...@gmail.com>.

Gonzalez, Miguel wrote:
> Do you see any failure on the rules? I have sent out the logs that I got, it seems that It gets on an endless loop.
>
> Many thanks
>
> Miguel
>
>   
>> -----Original Message-----
>> From: matt farey [mailto:matt.farey@gmail.com]
>> Sent: Monday, February 26, 2007 3:18 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] rewrite rules
>>
>> What URL you are actually requesting? - there are a few that will, but
>> that's ok provided you don't care about those.
>>
>> Gonzalez, Miguel wrote:
>>     
>>> Dear all,
>>>
>>>   I have Apache 2.0.54 on a Debian stable. I have what seems to be a
>>> endless loop:
>>>
>>>   mod_rewrite:
>>> maximum number of internal redirects reached. Assuming configuration
>>> error. Use 'RewriteOptions MaxRedirects' to increase the limit if
>>> neccessary.
>>>
>>>    the rules are:
>>>
>>>    IfModule mod_rewrite.c>
>>>         RewriteEngine on
>>>         RewriteCond %{REQUEST_URI} !^/index\.php$
>>>         RewriteCond %{REQUEST_URI} !^/.*\.html$
>>>         RewriteCond %{REQUEST_URI} !^/test\.php$
>>>         RewriteCond %{REQUEST_URI}
>>> !(admin/|images/|includes/|scripts/|css/|flash/|tree/)
>>>
>>>         RewriteRule ^([^/\.]+)(/(.*))?$ /tree/$3 [L,QSA]
>>> #       RewriteRule (.*) /index.php [L]
>>> </IfModule>
>>>
>>>   I have read that there are some issues in the rules definitions
>>>       
>> that
>>     
>>> could provoke an endless loop. But I am not an expert on writing
>>>       
>> these
>>     
>>> rules and these ones where written by someone else. Any thoughts?
>>>
>>>   Regards,
>>>
>>>    Miguel
>>>
>>> Miguel Gonzalez
>>> Threespot | 3333 14th street NW | Suite 300 | Washington, DC 20010
>>> T: | F: 202.518.0425 | E: miguel.gonzalez@threespot.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
>>>
>>>
>>>
>>>       
>> --
>> Matthew Farey
>> Web App Sec.
>> 25 The Polygon, Southampton, Hants, SO15 2BP, UK
>> Phone +44(0)2380 631449
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>>     
>
>   
does it do what you want if you use this:
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_URI} !^/?(index\.php|.*\.html|test\.php)$
 RewriteCond %{REQUEST_URI}
!(admin|images|includes|scripts|css|flash|tree)/?
 RewriteRule ^([^/\.]+)(/(.*))?$ /tree/$3 [L,QSA]
#RewriteRule (.*) /index.php [L]
</IfModule>


-- 
Matthew Farey



---------------------------------------------------------------------
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] rewrite rules

Posted by matt farey <ma...@gmail.com>.
What URL you are actually requesting? - there are a few that will, but
that's ok provided you don't care about those.

Gonzalez, Miguel wrote:
> Dear all,
>
>   I have Apache 2.0.54 on a Debian stable. I have what seems to be a
> endless loop:
>
>   mod_rewrite:
> maximum number of internal redirects reached. Assuming configuration
> error. Use 'RewriteOptions MaxRedirects' to increase the limit if
> neccessary.
>
>    the rules are:
>
>    IfModule mod_rewrite.c>
>         RewriteEngine on
>         RewriteCond %{REQUEST_URI} !^/index\.php$
>         RewriteCond %{REQUEST_URI} !^/.*\.html$
>         RewriteCond %{REQUEST_URI} !^/test\.php$
>         RewriteCond %{REQUEST_URI}
> !(admin/|images/|includes/|scripts/|css/|flash/|tree/)
>
>         RewriteRule ^([^/\.]+)(/(.*))?$ /tree/$3 [L,QSA]
> #       RewriteRule (.*) /index.php [L]
> </IfModule>
>
>   I have read that there are some issues in the rules definitions that
> could provoke an endless loop. But I am not an expert on writing these
> rules and these ones where written by someone else. Any thoughts?
>
>   Regards,
>
>    Miguel
>
> Miguel Gonzalez
> Threespot | 3333 14th street NW | Suite 300 | Washington, DC 20010 
> T: | F: 202.518.0425 | E: miguel.gonzalez@threespot.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
>
>
>   

-- 
Matthew Farey
Web App Sec.
25 The Polygon, Southampton, Hants, SO15 2BP, UK
Phone +44(0)2380 631449



---------------------------------------------------------------------
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