Home Guides Glossary

Change File Extension Handlers/Languages (Linux)

Your Linux Web Hosting account lets you process files in different languages. File extensions determine your account's default behavior. For example, your account processes files ending in .html as static HTML, and your account's default PHP version processes files ending in .php.

With Apache handlers, you can update your .htaccess file to change your account's default file extension behavior, or you can add custom file extensions.

Refer to the following table for the default behavior of dynamic languages.

Extension Handler Version
.php x-httpd-php Default PHP version
.php5 x-httpd-php5-3 PHP 5.3
.pl, .rb,
.py, .cgi
cgi-script Language dependent
.fcgi, .fpy,
fcgid-script Language dependent

Changing the default behavior of file extensions in your hosting account can yield unexpected results, possibly disabling installed software. This advanced feature is intended only for experienced users.

Some extensions require language-specific scripting preparation (for example, scripts for use via CGI or FastCGI), which is beyond the scope of this article.

Changing Default File Extensions

You can change your account's default file extension behavior by updating your .htaccess file with a handler.

For example, if your PHP version opens file extension .php, and you want to change it to PHP 5.3, add the following code to your hosting account's .htaccess file:

AddHandler x-httpd-php5-3 .php

Likewise, if you want FastCGI to process all files with extension .pl, add the following code to your hosting account's .htacess file:

AddHandler fcgid-script .pl

Creating Custom File Extensions

You can also create custom file extensions by updating your hosting account's .htaccess file with a handler.

For example, if you add the following code to your .htaccess file, PHP 5.3 can process the custom extension .mysite:

Options +ExecCGI
AddHandler x-httpd-php5-3 .mysite

Disabling FastCGI

You can disable FastCGI using this method by including the following in your .htaccess file:

Options +ExecCGI
addhandler x-httpd-php5-cgi .php

You cannot disable FastCGI with our cPanel shared hosting accounts (more info) or Web/Classic accounts using PHP versions 5.3 or later (more info).

Click here for more information about Apache handlers.

Domain Registration

Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. We have everything you need to get online with your new domain.

Website Builder

Build an amazing website in just under an hour with Website Builder. Take advantage of designs created just for your industry and then customize them to reflect your one-of-a-kind idea.

Website Security

Protect your website and keep customers safe. Your comprehensive Website Security solution. Get peace of mind by securing your websites. We fix hacks to help prevent attacks.

cPanel Hosting

Everything needed to give your website the high-performance home it deserves.  Protect transactions and secure your customer's data with a SSL Certificate
Copyright © 2005 - 2023.  All rights reserved.  Privacy Policy