How to parse .html or .htm files as .php?

You can set up the redirect using the CloudLinux LSAPI / LiteSpeed API by configuring your .htaccess or PHP handler settings.

1. Using LSAPI Handler

Add the following line to your .htaccess file or server configuration:

AddHandler application/x-httpd-lsphp .htm .html .shtml

2. Using Other PHP Handlers

  1. Create a .htaccess file in your public_html folder.

  2. Add these lines:

RemoveHandler .html .htm
AddType application/x-httpd-php .htm .html

Note: Since these files will now be treated as PHP, you may need to set their file permissions to 755 for proper execution.

3. Alternative Commands If Needed

If the above does not work, try either of the following:

AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml .html .htm

or

AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml .html .htm