0

I want to redirect error to specific page, so i wrote:

ErrorDocument 403 /error403.html

This is working, but in the HTTP response header I can still see HTTP/1.1 403 Forbidden.

Some browsers (like IE) that see that message, ignores the HTML code in the response (of error403.html), and showing their own page instead.

Is there any way to tell the server that if ErrorDocument handles an error, it will not include the HTTP error header?

Falcon Momot
  • 25,584
nrofis
  • 103

2 Answers2

1

Internet Explorer is silly and displays its own custom error pages instead of yours, if your error page is less than 512 bytes after compression. Make your error page at least 512 bytes (maybe add a long HTML comment, if you don't have that much to say).

Michael Hampton
  • 252,907
1

Do not do this. It will break the HTTP protocol. The internet is built on the assumption that servers will give proper error messages and that the clients will handle those error messages correctly.

In this case, if you really really want to make it look better just for IE, then use mod_rewrite to make an exception for IE. A basic crash-course in mod_rewrite is available at the canonical mod_rewrite question. In this case, you'll want a RewriteCond that triggers only when the User-Agent string matches IE.

Jenny D
  • 28,400
  • 21
  • 80
  • 117