mod_rewrite & 'file name too long'
Posted by: shelves
Posted on: 2006-10-12 23:44:00
I use mod_rewrite to send unknown requests to index.php:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule (.+) /index.php
The purpose is to let users add a string of article numbers to the url and have index.php process them by looking at $_SERVER['REQUEST_URI'], for example:
http://domain.com/0003947534975,00349587,0,1,45878
This works fine until that string of numbers is longer than 255 chars. Then error.log says: "File name too long". Access.log shows it's a 403 error. The displayed web page is the standard 403 error page, that says "Forbidden... Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument."
I tried to set an ErrorDocument for 403 errors in .htaccess but it's ignored. Does anyone know of any way to redirect or rewrite despite a file name too long error? I really just want it to ignore the whole url and let index.php handle everything.
If I use a '?' to make the url like this:
http://domain.com/?0003947534975,00349587,0,1,45878
Then it can handle as much as any GET request. Maybe you say that's silly, but I'd rather not require the '?' if I don't have to.
Any ideas?
Terry