Process PHP on HTML pages or other pages on Cloud Sites

  • Last updated on: 2016-01-12
  • Authored by: Rackspace Support

You can cause PHP to be processed on HTM and HTML pages by setting those extensions to be served by the PHP handler. You can enable PHP processing on .htm and .html files in your .htaccess file with the following directives:

AddHandler application/x-httpd-php php htm html
AddType text/html php

Following the preceding example, if you wanted to process PHP on files with the .test extension, you would use the following code:

AddHandler application/x-httpd-php php test
AddType text/html php

You can find more information about AddHandler and AddType on Apache’s website.

Note: We recommend using just the .php extension for PHP pages.

Continue the conversation in the Rackspace Community.