Forum Moderators: phranque

Message Too Old, No Replies

Redirect on accepted mimetype?

text/html to html.php and application/xhtml+xml to xhtml.php?

         

JAB Creations

6:35 pm on Dec 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've begun serverside development of the latest version of my site and I'm now extremely interested in maxing out my knowledge of the currently supported technologies. This includes serving proper mimetypes and understanding which browsers and versions of those browsers support those mimetypes.

I know that browsers can somehow talk to the server and announce what mimetypes they support...so how would I be able to for testing purposes on my local apache box send browsers with application/xhtml+xml support to xhtml.php and browsers that only support text/html to html.php? Remember that the default is the first mimetype (I'm serving XHTML 1.1) and I am creating a greylist of sorts of UAs that will have to be served text/html. I suppose this should be done when a certain file is requested, how about "mimetest.php" requests will redirect with this test?

This will help me clarify some things much better (by having a visual of the filename that Apache redirects me to on my system). If a browser will render (even badly) a page that is served as application/xhtml+xml then apparently Opera 3.62 supports application/xhtml+xml but in this instance I'd like to confirm it (as one of my more extreme examples, heh).

jdMorgan

6:59 pm on Dec 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think you're looking for the client HTTP_ACCEPT header, testable with mod_rewrite, mod_setenvif, and with most scripting languages.

Jim

JAB Creations

7:07 pm on Dec 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?php $mime = $HTTP_SERVER_VARS['HTTP_ACCEPT']; print $mime;?>

Yeah...well I just wanted to see what would vocally say, "yes, I support that". In example Opera 5+ will support application/xhtml+xml however earlier versions do not declare support even for text/html adding yet more confusion.

So I will treat "quiet" browsers like "quiet" vendors. If it doesn't say the hard drive has 8mb of cache then I must assume it only has 2mb of cache.