httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krist van Besien" <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] Problems with RewriteRule in .htaccess
Date Fri, 28 Nov 2008 12:18:48 GMT
On Fri, Nov 28, 2008 at 1:02 PM, Andrew Connick
<andrew.connick4@virgin.net> wrote:

> Also, as it stands, I get an internal server error, which I can fix by
> uncommenting #RewriteRule  ROOT/ - [L]  but why is this line needed ?

You problem is due to the way RewriteRules are processed in a
.htaccess file  context. RewriteRules in a .htaccess file  context are
only applied after Apache has found out what file to serve, because
that is when .htaccess files are read. If the rules change the URL
apache will restart the request, because the change could mean it now
has to read another .htaccess file...
This can lead to loops, which lead to internal server errors.
In your case apache will, after rewriting foo.html to ROOT/foo.html,
restart the requests and this causes a  rewrite to ROOT/ROOT/foo.html,
which causes a restart of the request which causes a rewrite until
some limit gets reached and a server error will be logged.
The rule you need to add breaks this loop:
RewriteRule  ROOT/ - [L

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

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