How can you redirect ALL 404 pages on a server to a single php file?
vaxop
7:59 am on Jun 5, 2007 (gmt 0)
I have like 40 domains on a server and Id like all 404 pages (including all subdomains) to be redirected to a single php file (passing the requested URL to the script)
Anyone know how to do this?
phparion
8:07 am on Jun 5, 2007 (gmt 0)
I guess it can be done with http.conf found under /etc/httpd/conf/http.conf
ErrorDocument 404 /404.php
so that it will be implemented throughout the server
vaxop
8:54 am on Jun 5, 2007 (gmt 0)
thanks :) also, how can i pass the URL that was requested to the php file?
jdMorgan
1:33 pm on Jun 5, 2007 (gmt 0)
It should be available in a server variable -- REQUEST_URI is what it's called at the server level, and PHP's name for it will be similar.
Jim
jatar_k
1:35 pm on Jun 5, 2007 (gmt 0)
the varname in php is exactly the same $_SERVER['REQUEST_URI']