Can I run PHP for other file extensions like .html?

This page is showing a generic answer.
To see a more detailed answer customized for you, type your domain name here:

Our servers automatically use the PHP scripting language for any filename ending with “.php”.

It’s possible to run other files, like “.html” files, as if they were PHP scripts, too. Note that doing so slows down your site somewhat, so we don't particularly recommend it.

You can add this line to a .htaccess file at the top level of your site:

AddHandler application/x-httpd-php .html .htm

That’s all it takes to allow any “.html” or “.htm” file on your site to be treated as if it was a PHP script. You can add any filename extensions you want to the line.

Advanced topic: Using FastCGI

If you follow our instructions above, the extra file extensions will run under PHP, but they won’t use the “FastCGI” option offered by our PHP control panel. That means they’ll be fairly slow, making this option inappropriate for a busy site.

It’s possible for technically advanced customers to make these other extensions run under FastCGI.

However, doing so relies on a quirk of how PHP under FastCGI is implemented on our systems. We can’t guarantee that this will always work in the future — this may stop working completely if we, or you, change how PHP runs on our servers (which can include changes due to major PHP upgrades). It will also stop working if you later disable FastCGI for PHP in our control panel.

If you want to do this anyway, you should first make sure you’ve set PHP to use FastCGI for your site. Then add these two lines to your .htaccess file for each file extension you want to run with PHP under FastCGI:

AddHandler fcgid-script .extension
FcgidWrapper /var/www/settings/ex/example.com/php-fastcgi.fcgi .extension

Change “.extension” to the extension you want to use.

For example, if you want to run both “.htm” and “.html” files as PHP under FastCGI, you’d add these four lines:

AddHandler fcgid-script .htm
FcgidWrapper /var/www/settings/ex/example.com/php-fastcgi.fcgi .htm
AddHandler fcgid-script .html
FcgidWrapper /var/www/settings/ex/example.com/php-fastcgi.fcgi .html

Note that you do need two separate lines for each additional extension; you can’t combine them as in the non-FastCGI example above.