Content–Type for XML/XSL Jun03 '05

.htaccess file

Here’s the contents of my .htaccess file:

RewriteEngine on
RewriteRule !\.(xml|xsl|gif|jpg|css|js|txt)$ /home/username/path_to_index_file.php
AddType php-cgi .html .htm

Notice the xml and xsl rewrite rules (among the others), which tells the rewrite engine to redirect every file except ones with those extensions.

Content–Type header

Here’s my Content–Type header, in my index file:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Every file, beside the ones with extensions from above, gets re–directed to my index file, which contains the Content–Type header from above.

XML treated as HTML

However, it doesn’t seem to be working properly, because XML or XSL files are still being re–directed to my index file, and I don’t want them to be.

My XML or XSL files are being treated as text/html, which inhibits them from being displayed, or rendered properly.

Does anyone know the appropriate Content–Type for an XML or XSL file?

Categories: Apache , Web Development , XHTML

Add Feedback (view all)

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

application/xhtml+xml - as just recently alluded to on the ... Read more.

Perfect... thanks Josh. I wonder how much of an effect changing text/html to application/xhtml+xml would have on m ... Read more.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

Similar Entries

Stats

51 unique visits since August 2008

Syndicate

Advertisements