# Overriding Apache test/plain MIME Type



## TommyWillB (Jul 19, 2003)

I swear this ought to be easy... I'd like to override Apache's default MIME tye of text/plain for .cfm files.

It seems this can be acomplished two ways:

1) Put "AddType text/html .cfm" in the httpd.conf file

2) Update /private/etc/httpd/mime.types so that it has "text/html			html htm cfm"

I've done both, and restared Apache, but it refuses to actually work. Here is the URL of my test page: http://www.jeffntom.com/tom/about_me/background.cfm

This has some JavaScript redirect code (which I know I can do in Apache, but that's not the point).

Unfortunately both Safari and IE ignore MIME types and simply redirect, which masks the problem. Netscape/Mozilla/Firebird actually does the RIGHT thing... which is NOT interpret this as HTML and NOT redirect.

So if I can get Apache to send this file as text/html then I'd expect Netscape/Mozilla/Firebird  to redirect just like Safari/IE.

Any ideas on how to make Apache send the correct MIME TYPE?


----------



## Darkshadow (Jul 19, 2003)

OK, I just copied that background.cfm to my server, made a dummy background.html file, and tested it.  Safari does ignore MIME types (really annoying, I had to change some perl source files because of that so they'd display as text...).

I tested it with iCab.  First your site, then mine.  Yours doesn't appear to be mapping .cfm to text/html.

When I added the AddType text/html .cfm to my httpd.conf file, it did load fine for me.  It also immediately redirects (is this what you wanted?) like Safari did.

Maybe you added the line to the httpd.conf file wrong?  In my case, I didn't add anything to the mime.types file.

If you'd like to test it - http://dreamstatic.dyndns.org/background.cfm


----------



## TommyWillB (Jul 20, 2003)

> _Originally posted by Darkshadow _
> *...Maybe you added the line to the httpd.conf file wrong?...[/url] *



mime_module and mime_magic_module are both loaded (I even checked phpinfo() to be sure)
I removed cfm from /private/etc/httpd/mime.types
I've added "AddType text/html .cfm" to the <IfModule mod_mime.c> section (not within any <Directory> or other blocks)of  /private/etc/httpd/httpd.conf
I save mime.types and httpd.conf and closed them
I've restarted Apache via the Terminal "httpd restart" (I also did this from the Sharing pref pane to be safe)
I quit and restarted Mozilla Firebird[/list=1] 

I'm still having the problem.

Does this Add Type need to be somewhere else?


----------



## TommyWillB (Jul 20, 2003)

OH!!!

I Set Mozilla's cache to 0 and then cleared it.

After Quitting and restarting it worked!

Can you confirm it works on your side?

background.cfm should redirect to background.html


----------



## Darkshadow (Jul 20, 2003)

Yep, it's working with iCab now...'tis the only thing besides Safari and IE I have to test with.


----------



## TommyWillB (Jul 20, 2003)

Thanks!

So do you think Safari's failure to treat text/plain is a bug?

Did you already report it?


----------



## Darkshadow (Jul 21, 2003)

A while back, before the v72 beta came out.  Still haven't seen anything more on it.  Maybe if more people post it as a bug.


----------

