View Full Version : IE Won't display default error page

07-14-2012, 05:39 AM
I have a php script I wrote using IP based authentication. I have code that looks like this:

if ($_SERVER['REMOTE_ADDR'] != '') {
header("HTTP/1.0 403 Forbidden");

The problem is all I get is a blank page if i access it on a remote machine, well on IE atleast. I haven't tried from another browser.

What does it take to get IE to show its default 403 error page? I do not want to create a custom error page, the default browser one will work just fine....if i get get it to show.

On second thought I think I identified the problem, a look at the page source reveals there is output

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>

So I think the browser is considering that a custom error page and thus not thowing its own. How can I prevent the boilerplate html from being sent?

07-14-2012, 06:15 AM
use this instead

header("HTTP/1.0 403 Forbidden");

refer to