I would like to produce a 404 error intentionally for some pages on my server, and I am currently working on the headers. The problem is, for the scripts that exists (and I give a 404 error in the script), the Content-Type
header field shows text/html; charset=UTF-8
, while for the real 404 pages the same field shows text/html; charset=iso-8859-1
, which defeats my purpose. I've tried adding AddDefaultCharset UTF-8
to the main config but there's no luck. The question is, how to set the charset on these real error pages?
Asked
Active
Viewed 381 times
0
![](../../users/profiles/355980.webp)
lkp111138
- 236
- 1
- 5
-
Define "I give a 404 error in the script"? Is that Apache server returning a 404? some other backend? – ezra-s Feb 14 '17 at 16:45
-
It's something like `header('HTTP/1.1 404 Not Found')` – lkp111138 Feb 15 '17 at 08:12
-
so it's your script making the response , make your script return the correct charset. – ezra-s Feb 15 '17 at 16:34
1 Answers
0
Figured it out: Use ErrorDocument
for the desired error code (in this case 404), make it point to a script under the web root, then setting whatever I like in the ErrorDocument
.
![](../../users/profiles/355980.webp)
lkp111138
- 236
- 1
- 5