You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Walther Bauer <23...@googlemail.com> on 2010/09/24 15:59:18 UTC

[users@httpd] mod_rewrite loop

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.

Re: [users@httpd] mod_rewrite loop

Posted by Walther Bauer <23...@googlemail.com>.
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

Re: [users@httpd] mod_rewrite loop

Posted by Frank Gingras <fr...@gmail.com>.
  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@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] mod_rewrite loop

Posted by Eric Covener <co...@gmail.com>.
On Fri, Sep 24, 2010 at 4:36 PM, Walther Bauer <23...@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 <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] mod_rewrite loop

Posted by Walther Bauer <23...@googlemail.com>.
Yeah, I've unterstood that so far. But why does the second example _not_
produce an infinite loop?

Re: [users@httpd] mod_rewrite loop

Posted by Frank Gingras <fr...@gmail.com>.
  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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org