Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- RewriteRule failure on new server


Mokita - 4:51 am on Mar 11, 2011 (gmt 0)


Recently we moved all our sites to a new server, which is running Apache 2.2, from one which was running 1.3.

Most of my RewriteRules that should result in a [F] are working properly as before, but four of them aren't. They are generating a loop, and eventually fail with this "default" message:

Forbidden

You don't have permission to access /example/ on this server.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


Normally a 403 error will present our custom 403 error document, not the default.

One of the problematic rules is this one:

RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteCond %{HTTP_USER_AGENT} !Windows\ NT\ (4\.0|5\.[0-2]|6\.[0-1])(\)|;\ [^)])
RewriteCond %{HTTP_USER_AGENT} Windows\ NT
RewriteRule .* - [F]

An example of a malformed user-agent that gets caught by this rule is:

Mozilla/4.0 (compatible; 6.0; Windows NT

I have looked at the code until I go cross-eyed, but can't see anything wrong with it. It was originally written by jdMorgan though, and I have to admit that my scant knowledge of regex means I don't really understand the very last part of the second RewriteCond.

Some help would be greatly appreciated.
TIA.


Thread source:: http://www.webmasterworld.com/apache/4280041.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com