Re: Problems with RewriteRule in .htaccess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 28, 2008 at 1:02 PM, Andrew Connick
<andrew.connick4@xxxxxxxxxx> 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@xxxxxxxxx
krist@xxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux