Managing MIME Types in cPanel
MIME types (Multipurpose Internet Mail Extensions) tell web browsers how to handle different types of files served by your website. When your server sends a file to a visitor’s browser, it includes a MIME type header that instructs the browser whether to display the file, download it, or process it in a specific way.
What Are MIME Types?
Every file type has an associated MIME type that identifies its format. For example:
| File Extension | MIME Type | Browser Behavior |
|---|---|---|
.html | text/html | Renders as a web page |
.css | text/css | Processes as a stylesheet |
.js | application/javascript | Executes as JavaScript |
.jpg | image/jpeg | Displays as an image |
.pdf | application/pdf | Opens in PDF viewer |
.mp4 | video/mp4 | Plays as video |
.json | application/json | Processes as JSON data |
.woff2 | font/woff2 | Loads as a web font |
Your web server already knows the most common MIME types. However, there are situations where you need to add custom ones.
When to Add Custom MIME Types
You may need to add a MIME type if:
- You are hosting files with uncommon extensions that the server does not recognize.
- Browsers are downloading files instead of displaying them (or vice versa).
- You are serving web fonts (e.g.,
.woff2) and getting console errors about incorrect MIME types. - You are using custom file formats specific to your application.
- You need to serve modern formats like
.webp,.avif, or.wasmthat older server configurations may not include.
Adding a MIME Type in cPanel
- Log in to cPanel.
- Navigate to the Advanced section.
- Click on MIME Types.
- In the Create A MIME Type section:
- MIME Type: Enter the MIME type (e.g.,
font/woff2) - Extension(s): Enter the file extension without the dot (e.g.,
woff2)
- MIME Type: Enter the MIME type (e.g.,
- Click Add.
The MIME type is added to your Apache configuration immediately.
Viewing and Removing MIME Types
Below the creation form, you will see a list of User Defined MIME Types. To remove a custom MIME type, click the Delete link next to the entry.
Note: You can only manage MIME types that you have added. System-level MIME types are managed by the server administrator.
Common MIME Types to Add
Here are MIME types that are frequently needed but may not be configured by default:
| Extension | MIME Type | Use Case |
|---|---|---|
woff | font/woff | Web Open Font Format |
woff2 | font/woff2 | Web Open Font Format 2 |
webp | image/webp | Modern image format |
avif | image/avif | AV1 image format |
svg | image/svg+xml | Scalable vector graphics |
wasm | application/wasm | WebAssembly |
webmanifest | application/manifest+json | Progressive web app manifest |
ics | text/calendar | Calendar files |
Alternative: Using .htaccess
You can also define MIME types in your .htaccess file:
AddType font/woff2 .woff2
AddType image/webp .webp
AddType image/avif .avif
AddType application/manifest+json .webmanifest
This achieves the same result and offers more flexibility if you need to set MIME types for specific directories.
Troubleshooting
- If a file still downloads instead of displaying, clear your browser cache and try again.
- Check your browser’s developer console (F12 → Console) for MIME type warnings.
- Ensure the file extension in the MIME type definition matches the actual file extension exactly.
Correctly configured MIME types ensure your website’s files are served and handled properly by browsers, avoiding display issues and security warnings.