Just Start Typing Text and Press Enter

Feb 29, 2020

GTMetrix Analysis Error: The URL did not appear to be an HTML page

0 Comment | By
GTmetrix logo

GTMetrix Analysis Error: The URL did not appear to be an HTML page

(invalid Content-Type: ; charset=UTF-8) GTmetrix only analyzes HTML pages and could not confirm that the URL is a HTML page.

Update: 2020-03-13 10:13 PM

Have a WordPress site and if you ever tried to scan your site using GTMetrix? Chances are that the scan goes through, but what do you do when you get the error above? Well, the error is right in front of us but if you’re like me when I was on the spot trying to figure this out for someone…it was not so obvious.

GTMetrix Analysis Error - The URL did not appear to be an HTML page (invalid Content-Type: ; charset=UTF-8)

Well then after looking at the FAQ at GTMetrics it is mentioned by them that:

The URL did not appear to be an HTML page
GTmetrix only analyzes HTML pages. To ensure that your page is a HTML page, GTmetrix checks to the Content-Type header for text/html.

You also may get this error if the Content-Type header is missing or the value is empty. The problem is likely an issue with the web application and not the web server.

Source: Frequently Asked Questions | GTmetrix

With that in mind I began to do the most obvious thing to me which was to curl the url that was having issues and sure enough this was the output:

HTTP/2 200
date: Sat, 29 Feb 2020 04:09:04 GMT
content-type: ; charset=UTF-8
expires=Mon, 30-Mar-20 04:09:03 GMT; path=/; domain=.somewebsite.com; HttpOnly; SameSite=Lax
x-pingback: https://somewebsite.com/xmlrpc.php
link: <https://somewebsite.com/wp-json/>; rel="https://api.w.org/"

As opposed to mine:

HTTP/2 200
date: Sat, 29 Feb 2020 04:08:48 GMT
content-type: text/html; charset=UTF-8
expires=Mon, 30-Mar-20 04:08:47 GMT; path=/; domain=.davidpolanco.com; HttpOnly; SameSite=Lax; Secure
vary: Accept-Encoding
link: <https://davidpolanco.com/wp-json/>; rel="https://api.w.org/"

Can you find the difference between the two? Well sure you can, see the content-type is not set on the first output, however it is on mine. For this reason GTMetrix kicks back with the error: GTMetrix Analysis Error: The URL did not appear to be an HTML page. Though not really an error but more of a “Hey, we only scan HTML pages…so go set the meta for it!”

Meta for the page:

Depending on if you use WordPress or some other content management system this setting may be in the following areas:

  • A SEO plugin may be effecting this.
  • If you have a premium theme it may be missing this meta tag.

To fix this issue you will need to do some investigating in your setup to find this tag. However, in WordPress you can edit the header.php file your theme by going to /wp-content/themes/{your_theme}/header.php then simply add/edit the following:

<meta http-equiv="content-type" content="text/html; charset=utf-8">


2020-03-13: In digging into this issue I noticed that in WordPress specifically (after digging through lines of the Genesis theme) that this is certainly not hard coded but is in the database wp_options table.

As mentioned in the screenshot there is a chance that either you are missing this row OR the option value has been removed. On my website here you can see I have my html_type on row 46. If you are using a newer WordPress site, chances are you will have the same row. Now then if you are missing this row you can simply open phpmyadmin then select the table and run the following query I wrote:

INSERT INTO wp_options (option_id, option_name, option_value, autoload) VALUES (‘46’, ‘html_type’, ‘text/html’, ‘yes’)

As always be sure to make a backup, and clear any caches that you may have enabled.


Not much behind this fix, the only tricky is actually locating the area to make the necessary adjustments. If this has happened to you, leave a comment on the location that was missing the text/html tag for you.

Leave A Comment