~Shinta Posted January 1, 2006 Share Posted January 1, 2006 Hi I need help with mime types.First off, I want to change my page's MIME type from what I suppose is text/xhtml to application/xml+xhtml. I think you do it in a meta tag, but I don't think it did the trick (because it still works in IE =P). Where do I change the mime type? I have a suspicion that you change it in the .htaccess file. Second, I want to be able to serve the page as text/xhtml to Internet Explorer users. My idea is to use a php script to do this... I just don't know how yet =P. Link to comment Share on other sites More sharing options...
F-Man Posted January 2, 2006 Share Posted January 2, 2006 By default. .html and .htm extensions are text/html (yes even if your document is XHTML 1.0) and .xhtml and .xht extensions are application/xhtml+xmlFor serving a working MIME type depending on the browser, I use this PHP script (use a .php extension of course): <?phpif(stristr($_SERVER["HTTP_ACCEPT"],'application/xhtml+xml')) { header('Content-Type: application/xhtml+xml; charset=UTF-8'); echo '<?xml version="1.0"?><?xml-stylesheet href="style.css" type="text/css"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head>';}else { header('Content-Type: text/html; charset=UTF-8'); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <link rel="stylesheet" href="style.css" type="text/css" />';}?> <title>Title</title></head><body></body></html> Though it can also be done through your .htaccess file which is better, but I don't know how. Link to comment Share on other sites More sharing options...
Jonas Posted January 2, 2006 Share Posted January 2, 2006 Can a file have the extension .xhtml? Link to comment Share on other sites More sharing options...
~Shinta Posted January 2, 2006 Author Share Posted January 2, 2006 Yes, you can have the extension .xhtml... I use .php though =P. I'm going to try that script, and see if it works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now