Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

What Are Apache Handlers and How to Add One

This guide explains Apache handlers and shows how to tell your server how to treat a file type.

How-To Guides2 min read11 steps

What is an Apache handler?

Apache is the software that serves many websites. When someone asks for a file, Apache must decide what to do with it. A handler is that decision. For a picture, Apache simply sends it. For a PHP file, Apache first runs it as a program. A handler links a file ending (an extension, like .php) to the right action. It is like a mail room clerk who sends letters to the right desk.

You might add a handler if you want files with a special ending, such as .html, to run PHP. Or if you want a custom ending to run as a script.

Method 1: In the control panel

In cPanel there is a tool called Apache Handlers. Your plan may not include it. Ask Hostvento support if you cannot find it.

  1. Log in to your control panel.
  2. Open Apache Handlers under the Advanced section.
  3. Under Extension(s), type the ending, for example .html.
  4. Under Handler, type the handler name. Your host's PHP handler name is shown on your server, and support can tell you the right one.
  5. Click Add.

Method 2: With .htaccess

.htaccess is a small settings file in your website folder. Warning: a mistake can cause a "500 error". Back up the file first.

  1. Open File Manager and turn on Show Hidden Files.
  2. Go to your website folder, such as public_html.
  3. Copy .htaccess to make a backup.
  4. Edit the original file.
  5. Add a line. This one makes .html files run through PHP:
AddHandler application/x-httpd-php .html .htm

The exact name after AddHandler depends on your server's PHP setup. Hosts often use a name that includes the PHP version, so check with support.

  1. Save the file and reload a page to test.
  • AddType sets what kind of file it is, so the browser knows how to show it.
  • RemoveHandler .html removes a handler you added.
Tip: Running every .html file through PHP slows down plain pages a little. Use it only when you need it.

Quick recap

  • A handler tells Apache how to treat a file ending.
  • Add it in the control panel tool or in .htaccess.
  • Use the correct handler name for your server.
  • Back up, save and test.