override server mime type

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to link to an mp3 file, as follows:

<a href="http://someserver.somedomain.com/somefile.mp3 ">
SomeNeatLinkText </a>

However, instead of downloading or playing the mp3., my browser seems
to just display a screenful of garbage. I am assuming this is because
the server is not sending the correct mime type. Is there any way to
override this? I tried

<a href="http://someserver.somedomain.com/somefile.mp3 "
type="audio/x-mpeg"> SomeNeatLinkText </a>

but that doesn't seem to work. Any suggestions i can implement from my
side(i.e. other than 'contact the server admin and get him to fix the
server's configuration').


Re: override server mime type

Dave wrote:
Quoted text here. Click to load it

If you're using Apahce and .htaccess is enabled, you can use an AddType
directive. http://httpd.apache.org/docs/mod/mod_mime.html#addtype

Re: override server mime type

Sometime around 2 Dec 2003 19:08:31 -0800, Dave is reported to have stated:
Quoted text here. Click to load it

You may[1] be able to set it to use the correct mime type in your
.htaccess[2] file.

Just add the line:

AddType audio/x-mpeg mp3


[1] Depending on how much control your host has given you. :-)
[2] Assuming your site is hosted on an Apache server. A .htaccess file is a
plain text file called exactly that (if creating it in Notepad, save it
with quotes around the name, i.e. ".htaccess", to prevent Notepad from
adding a .txt extension). Upload it to your site root, and try your mp3

Mark Parnell

Re: override server mime type

Dave said:

Quoted text here. Click to load it

you're probably right, who knows, you haven't supplied a URL for people
to see if that is the case or not.

assuming your server is apache:

03/December/2003 01:33:38 pm kilo

Re: override server mime type

Dave wrote:
Quoted text here. Click to load it

The type attribute is informative, not authoritative. The content-type
header sent by the server is authoritative. You have to change the content
type sent by the server.

David Dorward                                      <http://dorward.me.uk/

Site Timeline