H
10Corp Premium Hosting

Managing MIME Types in cPanel

Last Updated: 2025-01-01 3 min read

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 ExtensionMIME TypeBrowser Behavior
.htmltext/htmlRenders as a web page
.csstext/cssProcesses as a stylesheet
.jsapplication/javascriptExecutes as JavaScript
.jpgimage/jpegDisplays as an image
.pdfapplication/pdfOpens in PDF viewer
.mp4video/mp4Plays as video
.jsonapplication/jsonProcesses as JSON data
.woff2font/woff2Loads 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 .wasm that older server configurations may not include.

Adding a MIME Type in cPanel

  1. Log in to cPanel.
  2. Navigate to the Advanced section.
  3. Click on MIME Types.
  4. 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)
  5. 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:

ExtensionMIME TypeUse Case
wofffont/woffWeb Open Font Format
woff2font/woff2Web Open Font Format 2
webpimage/webpModern image format
avifimage/avifAV1 image format
svgimage/svg+xmlScalable vector graphics
wasmapplication/wasmWebAssembly
webmanifestapplication/manifest+jsonProgressive web app manifest
icstext/calendarCalendar 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.

Tags: cpanel hosting mime-types file-types

Still need help?

Our support team is available 24/7 to assist you.