The .htaccess file is located in the root directory of your web server. This is usually the public_html directory. In most cases the .htaccess file already exists. It is IMPORTANT that you save a copy of this original .htaccess file before editing or deleting the original.
You will need the following tools to safely access and edit the .htaccess file on your web server.
- cPanel Access if Using File Manager
- FTP Program like FileZilla if using FTP
It is important to note that the (.) in front of the .htaccess file tells the web server that this is an invisible file. What this means is that you will not be able to see it unless you have told the program you are using to access it to show hidden files.
Using the cPanel File Manager to Access .htaccess
If you are going to edit the .htaccess file using the “File Manager” program available in your cPanel you must enable the “Show Hidden Files” option. It is normally off by default.
Click on Settings and locate the “Show Hidden Files(dotfiles) option.
Place a checkmark inside the Show Hidden Files option and click “Save”
Note: The Show Hidden File feature is usually enabled by default in FileZilla
Adding the Code to .htacces
Now that you can see the file it is important to make a copy of the existing .htaccess before doing anything else. This can be done by using the copy file option in File Manager or downloading a copy to your local computer in a safe spot. The reason for this is obvious, you never want to make an edit or add changes to a file that you are not able to immediately go back to a working state for. Simple typos and incorrectly worded directives can make your web server unusable until it is fixed.
Once you have a safe backup copy of .htaccess it is time to enter the code that will enable the .gzip compression and speed up your website.
Copy the above code and paste it into your .htaccess file. Once it has been correctly placed save the file and then visit your website to make sure it still works.
Test .gzip Compression | Lets Make Sure it Works
You can use free tools that are available to check that gzip compression is properly working on your website. I recommend using the HTTP Compression test at WhatsMyIP.org It’s simple, put in your website address and it will tell you whether your gzip compression is working.
Website Help Is Here If You Need/Want It
Don’t forget that we do offer website help and assistance. Even if you are not currently a member of supportforweb.us we still offer advice and can help any time you need. You can also use the comments here to offer suggestions and ask questions.