Grow your CSS skills. Land your dream job.

Last updated on:

Force Correct content-type for XHTML Documents

Most webservers serve XHTML content as text/html what is definitly the right way to handle XHTML documents. In case the server isn't doing that correctly, you can force it on Apache servers with .htaccess:

RewriteEngine On
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml
RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0
RewriteCond %{REQUEST_URI} \.html$
RewriteCond %{THE_REQUEST} HTTP/1\.1
RewriteRule .* - "[T=application/xhtml+xml; charset=ISO-8859-1]"

Reference URL

Comments

  1. Hendrik
    Permalink to comment#

    Is there any reason to use iso-8859-1 instead of utf8? iso-8859-1 can neither use the € symbol nor popular european characters like üäöé …

  2. Permalink to comment#

    Or spanish characters as ñ!

Leave a Comment

Current day month ye@r *

*May or may not contain any actual "CSS" or "Tricks".