Forum Moderators: phranque

Message Too Old, No Replies

How can I setup ErrorDocument 404 to point to a file on my server?

         

vaxop

12:18 am on Jun 8, 2007 (gmt 0)

10+ Year Member



Hiya
I have about 50 domains on my server, and Id like to redirect ALL 404 pages (on ALL subdomains and domains) to a single php file.

The domains are located on the server as:
/home/admin/domains/ADOMAIN.com/public_html/
/home/admin/domains/ANOTHERDOMAIN.com/public_html/
etc

Id like to redirect the 404 pages to /home/admin/domains/r.php. Is this possible? Is there any way to do just an 'internal' direct so a user accessing a 404 page would have no indication that the 404 page is going through r.php?

Basically r.php will log the URL and redirect the user accordingly to another URL (lets say www.google.com). How can I make it so if someone accesses www.mydomain.com/a404page.html, they get redirected to www.google.com (via r.php) but have no indication on their end (even through packet sniffing) that they first went to r.php, and THEN to www.google.com (an internal redirect)?

Thanks :)

PS: I know I have to edit httpd.conf, but I dont know how to do the internal redirect part.

jdMorgan

1:08 am on Jun 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See Apache mod_alias. You can Alias the URL-path in each virtual server/account to a common filepath.

An alternative is to use symbolic links, so that each account appears to have a 404 ErrorDocument file, but these files are actually just symbolic links pointed to a common file -- your error-handling script.

Jim