Modifying or Adding Custom MIME Types to Windows Hosting Accounts
Using a Windows hosting account running IIS 7, you can modify or add MIME types. This lets you specify how Web browsers handle file extensions. Your hosting account already handles a number of different MIME types. For more information, see What MIME types does my Windows hosting account support by default?.
To modify or add custom MIME types, you must create or edit your account's web.config
file. For more information about web.config
files, see ASP.NET's Web.Config Basics.
To Modify Existing MIME Types
Create or edit a web.config
file in your account's root directory to include the following:
<system.webServer>
<staticContent>
<remove fileExtension=".EXTENSION" />
<mimeMap fileExtension=".EXTENSION" mimeType="TYPE/SUBTYPE" />
</staticContent>
</system.webServer>
</configuration>
Enter your own values for EXTENSION
, TYPE
, and SUBTYPE
, where:
EXTENSION
is the file extension you want to serve to the browserTYPE
is the MIME type you want to use, such asapplication
,image
, orvideo
SUBTYPE
is the MIME subtype you want to use
For example, you could use this code in your web.config
file, if you want to add MP4 files to your website:
<system.webServer>
<staticContent>
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
</staticContent>
</system.webServer>
</configuration>
To Add Custom MIME Types
Create or edit a web.config
file in your account's root directory to include the following:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".EXTENSION" mimeType="TYPE/SUBTYPE" />
</staticContent>
</system.webServer>
</configuration>
Enter your own values for EXTENSION
, TYPE
, and SUBTYPE
, where:
EXTENSION
is the file extension you want to serve to the browserTYPE
is the MIME type you want to use, such asapplication
,image
, orvideo
SUBTYPE
is the MIME subtype you want to use