Managing Apache Handlers in DirectAdmin
Summary
This guide explains how to view, add, and manage Apache Handlers in DirectAdmin. Apache Handlers tell the web server how to process specific file types or extensions.
Overview
Apache Handlers allow you to override default server behavior. For example, you can force certain file extensions to be processed as PHP, or treat custom extensions as CGI scripts. These rules apply at the user level and affect only your hosting account.
Requirements
- DirectAdmin user-level access
- Basic understanding of MIME types or scripting languages
- A domain hosted on the server
Step-by-Step Instructions
1. Access Apache Handlers
- Log in to DirectAdmin
- Go to Advanced Features → Apache Handlers
- Select the domain you want to manage
2. Add a New Handler
- Click “Create Handler”
- Enter the handler name (example: application/x-httpd-php)
- Enter the file extension(s) you want to apply it to (example: .php5)
- Click “Create”
3. Common Handler Examples
Process .php5 files as PHP:
Handler: application/x-httpd-php
Extension: .php5
Treat .cgi files as CGI scripts:
Handler: cgi-script
Extension: .cgi
Force .html files to run as PHP (not recommended):
Handler: application/x-httpd-php
Extension: .html
4. Remove a Handler
- Go to Apache Handlers
- Find the handler in the list
- Click “Delete”
- Confirm removal
5. How Handlers Work
Handlers modify how Apache interprets files:
- They do NOT change file content
- They override default server behavior
- They can affect performance and security if misconfigured
Troubleshooting
Handler Not Working
- Ensure the handler name is correct
- Confirm the extension starts with a dot (example: .php5)
- Check .htaccess for conflicting rules
Website Errors After Adding a Handler
- Remove the handler to test if it is the cause
- Check error logs in DirectAdmin → Site Summary / Logs
PHP Files Download Instead of Running
- Ensure the correct PHP handler is set
- Remove any incorrect or conflicting handlers
Security Warning
Avoid forcing HTML files to run as PHP unless absolutely necessary. This can expose sensitive content.
Related Articles
- MIME Types
- PHP Settings
- Custom Error Pages
- Directory Password Protection