How to Set Custom Apache Handlers in cPanel


Apache Handlers tell your web server how to process specific file types. For example, you can configure the server to treat .html files as PHP, or to process custom script types. This is useful for advanced web development configurations.

Steps to Add a Custom Handler

  1. Login to cPanel.
  2. Under Advanced, click Apache Handlers.
  3. In the Handler field, enter the handler name (e.g., application/x-httpd-php).
  4. In the Extension(s) field, enter the file extension(s) to associate (e.g., html htm).
  5. Click Add.

Common Handler Examples

  • Parse HTML as PHP: Handler: application/x-httpd-php | Extension: html
  • CGI Scripts: Handler: cgi-script | Extension: cgi pl
  • Server Side Includes: Handler: server-parsed | Extension: shtml

Adding via .htaccess

# Treat .html files as PHP
AddHandler application/x-httpd-php .html .htm

# Enable CGI scripts
AddHandler cgi-script .cgi .pl

Note: Incorrect handler configuration can cause website errors. Always test after adding handlers and keep a backup of your .htaccess file.

Removing a Handler

To delete a custom handler, go to cPanel → Apache Handlers, find the handler in the User-Defined Handlers list, and click Delete.

If you continue to face issues, please open a create a request.

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)