mod_rewrite loop

--001485f91cbeefa471049101c805
Content-Type: text/plain; charset=ISO-8859-1

This .htaccess snippet creates an "Request exceeded the limit of 10 internal
redirects"-error on my server (XAMPP):

RewriteEngine On
RewriteRule ^(.*)$ ./server.php

while the following does not:

RewriteEngine On
RewriteRule ^(.*)$ server.php

So why does the "./" actually make a difference?
Thanks in advance.

--001485f91cbeefa471049101c805
Content-Type: text/html; charset=ISO-8859-1

This .htaccess snippet creates an "Request exceeded the limit of 10 internal redirects"-error on my server (XAMPP):<br><br>RewriteEngine On<br>RewriteRule ^(.*)$ ./server.php<br><br>while the following does not:<br>
<br>RewriteEngine On<br>RewriteRule ^(.*)$ server.php<br><br>So why does the "./" actually make a difference?<br>Thanks in advance.<br>

--001485f91cbeefa471049101c805--
Walther Bauer [ Fr, 24 September 2010 15:59 ] [ ID #2048469 ]

Re: mod_rewrite loop

On 24/09/2010 9:59 AM, Walther Bauer wrote:
> This .htaccess snippet creates an "Request exceeded the limit of 10 internal
> redirects"-error on my server (XAMPP):
>
> RewriteEngine On
> RewriteRule ^(.*)$ ./server.php
>
> while the following does not:
>
> RewriteEngine On
> RewriteRule ^(.*)$ server.php
>
> So why does the "./" actually make a difference?
> Thanks in advance.
>

Walther,

(.*) matches server.php. You either need to use a regexp that doesn't match the target, or use a
RewriteCond on REQUEST_URI to achieve the same effect.

Frank

------------------------------------------------------------ ---------
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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Frank Gingras [ Fr, 24 September 2010 21:59 ] [ ID #2048472 ]

Re: mod_rewrite loop

--001636284a8c0d44f60491075724
Content-Type: text/plain; charset=ISO-8859-1

Yeah, I've unterstood that so far. But why does the second example _not_
produce an infinite loop?

--001636284a8c0d44f60491075724
Content-Type: text/html; charset=ISO-8859-1

Yeah, I've unterstood that so far. But why does the second example _not_ produce an infinite loop?<br>

--001636284a8c0d44f60491075724--
Walther Bauer [ Fr, 24 September 2010 22:36 ] [ ID #2048473 ]

Re: mod_rewrite loop

On Fri, Sep 24, 2010 at 4:36 PM, Walther Bauer <2313218 [at] googlemail.com> wrote:
> Yeah, I've unterstood that so far. But why does the second example _not_
> produce an infinite loop?

Can you attach a rewritelog of the two cases? Must be some usually
uninteresting quirk as opposed to the standard looping caveats.


--
Eric Covener
covener [at] gmail.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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Eric Covener [ Fr, 24 September 2010 22:41 ] [ ID #2048474 ]

Re: mod_rewrite loop

On 24/09/2010 4:36 PM, Walther Bauer wrote:
> Yeah, I've unterstood that so far. But why does the second example _not_
> produce an infinite loop?
>

You need to check the RewriteLog to find out why. It may depend on the context, or other factors.

Frank

------------------------------------------------------------ ---------
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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Frank Gingras [ Fr, 24 September 2010 22:42 ] [ ID #2048475 ]

Re: mod_rewrite loop

--001636c5ba590b6d5304910a0e64
Content-Type: text/plain; charset=ISO-8859-1

Ok, thanks for mentioning RewriteLog, didn't know there is an extra logfile
for mod_rewrite. That helped me figuring it out:
In the second example, apache recognizes the rewritten url equals the
original url and aborts rewriting process. ("initial URL equal rewritten
URL: test/server.php [IGNORING REWRITE]")
In the second example it doesn't because "test/./server.php" does not equal
"test/server.php" -> infinite rewrite

--001636c5ba590b6d5304910a0e64
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Ok, thanks for mentioning RewriteLog, didn't know there is an extra log=
file for mod_rewrite. That helped me figuring it out:<br>In the second exam=
ple, apache recognizes the rewritten url equals the original url and aborts=
rewriting process. ("initial URL equal rewritten URL: test/server.php=
[IGNORING REWRITE]") <br>
In the second example it doesn't because "test/./server.php" =
does not equal "test/server.php" -> infinite rewrite<br>

--001636c5ba590b6d5304910a0e64--
Walther Bauer [ Sa, 25 September 2010 01:51 ] [ ID #2048477 ]
Webserver » gmane.comp.apache.user » mod_rewrite loop

Vorheriges Thema: Authentication question: user OR group
Nächstes Thema: firefox 3.6.9 fails to connect due to SSL DHE