Php-cgi and custom 404 pages

software development



Before turning on the PHP-CGI option, I had a little cgi script which perfectly did its job.
in my .htaccess file :

ErrorDocument 403 /cgi-bin/Error_Pager.cgi?log ErrorDocument 404 /cgi-bin/Error_Pager.cgi?log ErrorDocument 500 /cgi-bin/Error_Pager.cgi?logIf someone tried to load, the script Error_Pager.cgi would write down all the relevant 404/403/500 errors in a log file and ‘display’ the relevant “$ENV{‘REDIRECT_STATUS’}.html” page (this is the the actual code on the script).

Now, I’m running PHP-CGI.
As “expected”, if, say, a file.html is missing, my script is doing its job. If a php file is missing, there’s no log about it in the log file and on the browser there’s only the line “no input file”.

I’ve tried to add a few lines to my .htaccess as described in :

ErrorDocument 403 /cgi-bin/Error_Pager.cgi?log ErrorDocument 404 /cgi-bin/Error_Pager.cgi?log ErrorDocument 500 /cgi-bin/Error_Pager.cgi?log Rewritecond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteRule \.php$ /cgi-bin/Error_Pager.cgi?log Well, now, the script is logging the “error” (if trying to get a non-existent php page), but on my browser I get :

Cgi Error!
Can’t open error page /home/me-user/mywebsite/cgi-bin/200.html

How can I send the right 404 status to the script?
Thanks in advance for your suggestions,