php-cgi and custom 404 pages...

php-cgi and custom 404 pages...

Posted by: remigm
Posted on: 2005-02-18 09:57:00

Hello

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

If someone tried to load http://mywebsite.com/doesntexist.anything, 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 https://panel.dreamhost.com/kbase/?area=2933 :

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,


--Remi

Tags: php cgicgi bincgi errordreamhosthtaccess filemywebsitehttpshttphtmlbrowserjobscript errorscript thanksrequest uricustom 404