Access apache errordocument directive from PHP

后端 未结 3 747
遇见更好的自我
遇见更好的自我 2021-01-06 05:10

I would like to make a php script output like a real 404 page (as set in the Apache ErrorDocument directive) if certain conditions are not met. I\'m not sure how I can / if

3条回答
  •  借酒劲吻你
    2021-01-06 05:44

    Your example seems good. You need to use the php header function to do that:

    
    

    Like that you're saying that this page is a 404, and you can then fill in the contents with what you want

    A real 404 is just any piece of code that send's a 404 error code back to the browser, so ErrorDocument or header(..404...) are equivalent in this regard.

提交回复
热议问题