Default files .htaccess and php.ini

Note: If the .htaccess file is coded incorrectly, it can cause website errors. Please keep in mind that HostGator does not provide direct support regarding the coding of .htaccess files. This resource is for informational purposes only.

Before you make changes to your .htaccess file, we strongly recommend creating a full backup of your files. For additional information on how to generate a full backup, please refer to the following article:

The .htaccess file is a special Apache file that you can use to manipulate the behavior of your site. These manipulations include things such as redirects that force all of your domain's pages to https or www. You can even redirect all users to one page, while your IP loads another page. Default .htaccess files for common CMS scripts are also included in the event you need to restore the file back to the default code.

For additional information on .htaccess files please refer to the following article:

Note: Links ending with [ + ] or [ - ] can be used to toggle more resources within this article.

Click any button to pop up a box containing .htaccess code.


CMS Default .htaccess Files [+]

In the event you need to restore the default .htaccess file for a specific CMS script, such as WordPress or Joomla, you can use the code provided within this section to directly copy into your .htaccess file.


php.ini Files [+]

You can declare changes to PHP within in this file and update specific settings by manipulating variable values. For additional information regarding the php.ini file, please refer to the following article:


.htaccess Redirects and Rewrites [+]

Redirect and Rewrite methods within the .htaccess file include, but are not limited to, forcing www and https, as well as implementing page specific redirects.


Handler Example Codes [+]

A PHP handler defines the method of communication between the Apache web server and your PHP Scripts. This includes handling HTML pages as PHP and executing Perl scripts.

Note: It is no longer necessary to manually create handler statements to change the PHP version for a directory. For additional instructions regarding this process please refer to the following article: