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.
- Log in to your control panel.
- Open Apache Handlers under the Advanced section.
- Under Extension(s), type the ending, for example
.html. - 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.
- 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.
- Open File Manager and turn on Show Hidden Files.
- Go to your website folder, such as
public_html. - Copy
.htaccessto make a backup. - Edit the original file.
- Add a line. This one makes
.htmlfiles 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.
- Save the file and reload a page to test.
Related commands
AddTypesets what kind of file it is, so the browser knows how to show it.RemoveHandler .htmlremoves a handler you added.
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.