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 a suburb of 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

Popular Pages

  1. Fast rounded corners in Photoshop (5671 recent visits)
  2. PHP – passing variables across pages (2080 recent visits)
  3. JavaScript set selected on load (1735 recent visits)
  4. Removing all child nodes from an element (1206 recent visits)
  5. iPod songs out of order? (1008 recent visits)
  6. Firefox 3 smart address bar: wildcard search (911 recent visits)
  7. Britney - Everytime piano tab (869 recent visits)
  8. MySQL LEFT JOIN syntax (728 recent visits)
  9. Breathe Me - Sia (661 recent visits)
  10. Tumblr: how blogging should be (546 recent visits)

Similar Entries

Stats

3 unique visits since August 2008

Syndicate

Advertisements