Loading...

Knowledge Base
Save up to  70% off.  Start your website today!

.htaccess Guidance

 

The .htaccess file is a special Apache file that adjusts the way your website behaves. You can edit the existing .htaccess file on your site, or you can create a new text file in any directory and name it .htaccess.

.htaccess Example

Even if you erase and remove the .htaccess file, HostGator uses this code as a default.

DirectoryIndex index.html index.shtml index.php default.html home.html

You can override those defaults by creating your own rules.

DirectoryIndex home.html page1.php index.txt

My website says, "File exceeded"

If your website suddenly says "File Exceeded" or something similar, this means your .htaccess file has exceeded the set limit of 512 KB placed on our Shared hosting plans.

To resolve this error, go to your File Manager. You will find two .htaccess files, one of which was your original .htaccess file with your codes exceeding the 512 KB limit. Rename the active .htaccess file, then modify your original .htaccess file to fall within the set limit of 512 KB. Once done, reload your site.


Frequently Asked Questions

How can I secure my .htaccess file?

The .htaccess file is already protected and forbidden to browsers. To be sure, double-check that the file is named .htaccess and not htaccess or htaccess.txt. The file must start with a dot.


Can I delete my .htaccess file permanently?

You can delete the .htaccess file, but it will reappear immediately as a blank file. HostGator has default directives that will always be in place unless you create your directives to overrule ours.


Additional .htaccess Coding Resources

The following articles open external websites and are for reference only. Please note that HostGator cannot offer direct support for the information provided in the following external documentation.

For examples of common .htaccess codes, please see the following article:

Note: You may edit your .htaccess file (as described in this article). However, if you do not code the .htaccess file correctly, it can cause website errors. If you are looking for a guide in setting up .htaccess Redirects and Rewrites or simply want to know the default .htaccess file of the CMS scripts used for your site, you can check this article:

Please remember we do not offer support to code this, nor do we promise to make your code work.

 

Did you find this article helpful?

 
* Your feedback is too short

Loading...