Guides › HTML / PHP sites › Site down or error screens

Content-Type and Charset Headers Wrong: Downloads and Scripts Misbehave

Headers.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Site down or error page

If a page downloads instead of opening, text looks garbled, or scripts and styles are ignored, the server may be sending the wrong Content-Type or charset header.

1Inspect the header2Match the file type3Fix the charset4Set a default on Apache5Check PHP output6Look at proxies7RetestFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Inspect the header

Illustration for Step 1: Inspect the header

Open F12, Network, click the file and read Content-Type under Response Headers.

Step 2: Match the file type

Illustration for Step 2: Match the file type

HTML should be text/html, CSS text/css, JavaScript text/javascript, JSON application/json.

Step 3: Fix the charset

Illustration for Step 3: Fix the charset

Pages should declare UTF-8, both in a <meta charset="UTF-8"> tag and ideally in the header.

Step 4: Set a default on Apache

Illustration for Step 4: Set a default on Apache

In .htaccess add AddDefaultCharset UTF-8 and, if needed, AddType lines for unusual extensions.

Step 5: Check PHP output

Illustration for Step 5: Check PHP output

PHP files that send JSON should call header('Content-Type: application/json').

Step 6: Look at proxies

Illustration for Step 6: Look at proxies

A CDN or proxy may rewrite headers. Purge it.

Step 7: Retest

Illustration for Step 7: Retest

Hard refresh.

Still stuck?

If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.