Help - Search - Members - Calendar
Full Version: How to change Content-type header for HTTP file?
The Planet Forums > Control Panels > Plesk
CurtC
On my site, if a browser requests the file http://mydomain.com/download/myfile.prc, the file is sent with a header of "Content-Type: text/plain", which causes browsers on some OSes (ones which actually treat this info properly) to display it as text in the browser. How do I set the server to send it as "Content-Type: application/octet-stream"?

Files with extensions of .exe are being sent with the correct header BTW.
Squire
There are a few ways to do it.

You could add the Content-Type to the head of the page code, you could AddType in your httpd.conf file if you need it to be server wide, or if you need it for just a single domain or even just part of a domain you could do it via .htacess.

The .htacess method, which would be what I would use personally, would look like:

AddType application/octet-stream .prc
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.