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,244
  • 15
  • 63
  • 92
nrofis
  • 103
  • 2

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
  • 244,070
  • 43
  • 506
  • 972
  • But no all the websites that have errors pages ithe larger then 512 bytes, and IE still shows them. How its works? They don't remove the error header? Another question: Why IE ignores error that less then 512 bytes? – nrofis Mar 02 '14 at 17:33
  • Are they still larger than 512 bytes _after_ they were compressed? – Michael Hampton Mar 03 '14 at 00:21
  • No, smaller then 512. And still IE present them (even if the option of "friendly error pages" available) – nrofis Mar 03 '14 at 17:06
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
  • 27,780
  • 21
  • 75
  • 114