Difference between revisions of "MIME Types"
(Added questions from he.net/faq per mleber) |
|||
Line 32: | Line 32: | ||
This will block them from seeing not only your main pages, but all pages in all subdirectories. If you wish to block them from seeing only one, or a small set of, subdirectories, place the above code in the .htaccess file of the highest subdirectory that you want blocked. | This will block them from seeing not only your main pages, but all pages in all subdirectories. If you wish to block them from seeing only one, or a small set of, subdirectories, place the above code in the .htaccess file of the highest subdirectory that you want blocked. | ||
+ | |||
+ | ********** | ||
+ | |||
+ | 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 | ||
+ | |||
+ | How do I make it so that people cannot see my directories from the web? | ||
+ | |||
+ | You can either upload an index.html file to the directory, or add the following to your .htaccess file: | ||
+ | |||
+ | Options -Indexes | ||
+ | |||
+ | How can I block people from certain IP Address so they can't access my site? | ||
+ | |||
+ | You can add the following to the .htaccess file in your public_html directory: | ||
+ | |||
+ | order deny,allow | ||
+ | deny from 192.0.2.123 | ||
+ | |||
+ | (change the ip address to the offending ip) | ||
+ | |||
+ | This will block them from seeing not only your main pages, but all pages in all subdirectories. If you wish to block them from seeing only one, or a small set of, subdirectories, place the above code in the .htaccess file of the highest subdirectory that you want blocked. | ||
[[Category:Webhosting]] | [[Category:Webhosting]] |
Revision as of 22:40, 17 May 2010
Contents
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
How do I make it so that people cannot see my directories from the web?
You can either upload an index.html file to the directory, or add the following to your .htaccess file:
Options -Indexes
How can I block people from certain IP Address so they can't access my site?
You can add the following to the .htaccess file in your public_html directory:
order deny,allow deny from 192.0.2.123
(change the ip address to the offending ip)
This will block them from seeing not only your main pages, but all pages in all subdirectories. If you wish to block them from seeing only one, or a small set of, subdirectories, place the above code in the .htaccess file of the highest subdirectory that you want blocked.
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
How do I make it so that people cannot see my directories from the web?
You can either upload an index.html file to the directory, or add the following to your .htaccess file:
Options -Indexes
How can I block people from certain IP Address so they can't access my site?
You can add the following to the .htaccess file in your public_html directory:
order deny,allow deny from 192.0.2.123
(change the ip address to the offending ip)
This will block them from seeing not only your main pages, but all pages in all subdirectories. If you wish to block them from seeing only one, or a small set of, subdirectories, place the above code in the .htaccess file of the highest subdirectory that you want blocked.