mod_rewrite loop

mod_rewrite loop

am 24.09.2010 15:59:18 von Walther Bauer

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

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

Re: mod_rewrite loop

am 24.09.2010 21:59:39 von Frank Gingras

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 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: mod_rewrite loop

am 24.09.2010 22:36:58 von Walther Bauer

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


--001636284a8c0d44f60491075724--

Re: mod_rewrite loop

am 24.09.2010 22:41:55 von Eric Covener

On Fri, Sep 24, 2010 at 4:36 PM, Walther Bauer <2313218@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@gmail.com

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See 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: mod_rewrite loop

am 24.09.2010 22:42:46 von Frank Gingras

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 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: mod_rewrite loop

am 25.09.2010 01:51:18 von Walther Bauer

--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:
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]")

In the second example it doesn't because "test/./server.php" =
does not equal "test/server.php" -> infinite rewrite


--001636c5ba590b6d5304910a0e64--