|
|
Question : Error Handler For 404
|
|
hai... i configured apache to handle error 404. In the config. file of apache i have given ErrorDocument 404 /cgi-bin/missing_handler.pl. And i have written and place the perl pgm in the cgi-bin folder. It works fine if i evoke on the server using a web browser whenever i access the document which is not fiund in the server the server triggers the perl pgm.
But if i request the same from a browser on a different client machine, it throws 302 error. Then i simply tried to ErrorDocument 302 handler on the server. Then the client machne throws the 404 error. And when i tried both handler in the server, the clien throws 302 error.
I would like to trigger the error handler 404 whenever the request page is not there when it is accessed by a client mac. Normally the resources accessed are not htmls they are word docum. or pdf docum.
Would anyone help to trace this problem.
Thanks for your time and consideration Rajesh
|
Answer : Error Handler For 404
|
|
I believe I remember you saying somewhere that you are using cgi/perl..... Umm in this case suppose you want to display a file on MachineA to people on MachineB and MachineC, set the response type to the appropriate type via print "Content type: text/html\n\n" ...or print "Content type: image/gif\n\n" etc..
Now what you want to do is and im not sure of the exact synatx...
$thefile = "C:\x.html"; #Not sure if this would work.. but you can give it a try.. $thefile = "x.html"; my $data; open(FILE, $thefile) or die "Unable to open $!";
while ($data = ){ print $data }
close(FILE)
This effectively is like telling your computer to grab 'x.html'. You can do this for most types of files. O/W what you can also do is put the file:// under your web directory and then access it as a normal webfile relative to the root.
|
|
|
|