What is the .htaccess file and what do I use it for?
Htaccess files are hidden plain text files that are on the server to help control how your visitors interact with your website. The htaccess file is also used to block specific traffic from being able to view your website. If you look for your .htaccess file you’ll see that there’s no filename. The extension is .htaccess which tells the server what type of file it is. In cPanel you can see if you have a current .htaccess file using file manager but you will need to make sure you have selected to view hidden files. To view hidden files in file manager, select the File manager icon in cPanel and make sure the box is checked next to Show Hidden Files. Then click OK and you will be able to view hidden files.
WHAT CAN YOU DO WITH A .HTACCESS FILE?
You might have a private area of your website you wish to keep password protected. This password protection is actually set up in the .htaccess file. Most of the functions of the htaccess file, you do not have to concern yourself with as they will be automatically written through cPanel. This is the case of password protecting directories. While you set it up in cPanel, it actually writes a directive to your htaccess file.
Other functions of the htaccess file include, prohibiting hotlinks, rewriting URLs, setting default pages, creating redirects, reconfiguring account settings, and much more. It’s really important to realize how the htaccess file can affect your entire account. Changing something in the htaccess file can alter how your website functions so it’s really important BEFORE making changes to your htaccess to backup your current htaccess file.
TROUBLESHOOTING ERRORS CAUSED BY THE .HTACCESS FILE
If you are getting errors on your website, the .htaccess file can often be the culprit.