.htaccess Code for Content-Type Header
Set Content-Type Header using .htaccess AddType
For static web pages, it may be necessary to add the MIME Type for HTML to the HTTP web server configuration to send the appropriate Content-Type header. With the Apache HTTP Server, for example, the HTML 5 MIME Type can be added to the .htaccess file(s):
AddType application/xhtml+xml;charset=UTF-8 html
For a detailed explanation of why the Content-Type
header is set to application/xhtml+xml
, see HTML 5's HTML Serialization.
It is highly recommended that the charset
attribute specifying the character encoding of the HTML page be included in the Content-Type
header for non-XML user agents as well as in the xml declaration for XML parsers.