All Collections
Website Development
How to Add File Extension to MIME Types
How to Add File Extension to MIME Types

Adding MIME types using .htaccess

Updated over a week ago

While most of the content of your website is recognized automatically as text, images, etc., there may be some cases where you will need to specify the type of file extension via code to ensure that it works correctly.

To do it, you will need to add a line to your .htaccess file following this structure:

AddType type/subtype ext

Where type/subtype indicates the kind of document and ext the file extension associated with it. For example, for Windows Media Audio files (WMA), it would look like this:

AddType audio/x-ms-wma wma

Multiple file extensions can be associated with the same MIME type in the same line, such as this:

AddType video/mp4 mp4 m4v f4v f4p

Additional resources:

Did this answer your question?