Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: 404 to Apache

by artist (Parson)
on Oct 27, 2006 at 17:47 UTC ( [id://580967]=note: print w/replies, xml ) Need Help??


in reply to Re: 404 to Apache
in thread 404 to Apache

I don't need to know the location of '404 file' specified in Apache server. I might just to need to return the header as '404 not found' and let Apache server pickup from that.
--Artist

Replies are listed 'Best First'.
Re^3: 404 to Apache
by grep (Monsignor) on Oct 27, 2006 at 18:09 UTC
    It doesn't appear that will happen. You can send a '404' status through the header status CGI print $q->header(-status=>404); (which works, it does send a 404 error to the browser) but Apache seems to ignore it. As one might expect, since a 404 should normally occur before the script is called.

    You'll either have the use the Apache modules or parse the config for the standard Apache (ErrorDocument 404 /missing.html) page and return that along with the header status of 404.



    grep
    One dead unjugged rabbit fish later
      From CGI.pm docs:
      print redirect(-uri=>"http://somewhere.else/in/movie/land", -nph=>1, -status=>301);
        The -status parameter will set the status of the redirect.  HTTP
             defines three different possible redirection status codes:
      
                  301 Moved Permanently
                  302 Found
                  303 See Other
       The default if not specified is 302, which means "moved temporarily."
             You may change the status to another status code if you wish.  Be
             advised that changing the status to anything other than 301, 302 or
             303 will probably break redirection.
      
      
      
      That means, I cannot return 404, if I redirect. Is there any way around?
      --Artist
        I read that also, but I actually tried it before I posted. It does really work, my browser reported a 404.


        grep
        One dead unjugged rabbit fish later
        Depends, what does the RFC say?
      Add  -nph => 1,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://580967]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-16 18:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found