Difference between revisions of "MIME Types"
m (moved MIME Types and .htaccess to MIME Types: htaccess split off) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
The standard set of MIME types is defined in the file /usr/local/etc/httpd/conf/mime.types. However, you aren't limited to the types defined there. MIME types may also be added through the use of the AddType directive in .htaccess files. | The standard set of MIME types is defined in the file /usr/local/etc/httpd/conf/mime.types. However, you aren't limited to the types defined there. MIME types may also be added through the use of the AddType directive in .htaccess files. | ||
− | |||
== How do I add a MIME type? == | == How do I add a MIME type? == | ||
− | A MIME type can be added by creating a file called .htaccess in the directory containing the document you want to set the MIME type for. The file should contain a line in the following format: | + | A MIME type can be added by creating a file called [[htaccess|.htaccess]] in the directory containing the document you want to set the MIME type for. The file should contain a line in the following format: |
AddType mimetype ext | AddType mimetype ext | ||
Line 15: | Line 14: | ||
Where mimetype is a MIME type like application/futuresplash and ext is a file extension like spl | Where mimetype is a MIME type like application/futuresplash and ext is a file extension like spl | ||
+ | Example: | ||
+ | <pre>AddType application/x-httpd-php .shtml</pre> | ||
− | == How do I make it so that | + | == How do I make it so that clicking on a file (e.g. a program script) will cause it to be downloaded rather than run? == |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | Place an .htaccess file in the same directory as the script and include following line, where .fileextension is the extension of the file you want to be downloaded: | |
+ | <pre>AddType application/octet-stream .fileextension</pre> | ||
[[Category:Webhosting]] | [[Category:Webhosting]] |
Latest revision as of 15:23, 6 January 2012
This information only pertains to Hurricane Electric's Shared Web Hosting package. There may be different information in our other categories.
What are MIME types and how does the server use them?
MIME types are a standard way of specifying the type of a document. A web server uses MIME types to tell browsers what type of document the server is sending. For files, the server determines the MIME type by the file's extension (the file extension is the last part of file name, such as .html, or .gif).
The standard set of MIME types is defined in the file /usr/local/etc/httpd/conf/mime.types. However, you aren't limited to the types defined there. MIME types may also be added through the use of the AddType directive in .htaccess files.
How do I add a MIME type?
A MIME type can be added by creating a file called .htaccess in the directory containing the document you want to set the MIME type for. The file should contain a line in the following format:
AddType mimetype ext
Where mimetype is a MIME type like application/futuresplash and ext is a file extension like spl
Example:
AddType application/x-httpd-php .shtml
How do I make it so that clicking on a file (e.g. a program script) will cause it to be downloaded rather than run?
Place an .htaccess file in the same directory as the script and include following line, where .fileextension is the extension of the file you want to be downloaded:
AddType application/octet-stream .fileextension