The .htaccess file is a hidden, plain text file on the server that allows you to define local Apache configuration settings at the directory level for your site. Put simply, .htaccess can be used to do any number of things, including password protect a directory, redirect a domain, turn off directory indexing, or even change the default Index page for a site.
When to use .htaccess and when to use cPanel
If you've ever setup a redirect or enabled password protection on a directory, you've actually already used your .htacess file. cPanel simply makes the changes to the .htaccess file for you through it's interface. While the tools available in cPanel are quick and easy ways to make these changes, occasionally there can be a conflict if you have other code already in your .htaccess file or if you need to set certain redirects that the cPanel interface can't interpret properly.
What to know before you edit the .htaccess file
First and foremost, before you make any changes to your .htaccess file, make sure you make a copy of it. It's important to remember that the .htaccess file is quite powerful and very sensitive to syntax errors. If you keep a backup of the .htaccess file and your site goes down while editing, you can simply restore from the backup. If you're going to be making multiple changes to the .htaccess file it's a good idea to make a backup after each change so you can revert back to the latest good copy.
Troubleshooting .htaccess Errors
Errors caused by .htaccess are not always obvious. You're not going to see an error that says "Check your .htaccess file." Common errors that can often be traced back to the .htaccess file are:
One of the first steps you can do when troubleshooting .htaccess errors is to try renaming the .htaccess file. If this resolves the error, then you know it's something in the .htaccess file. If it doesn't resolve the issue, simply change the name back to .htaccess.
Editing the .htaccess File
For step-by-step instructions on making changes to your .htacces file, please see our article How to edit your .htaccess file.
If you have questions or need any assistance with your .htacces file, please feel free to ask a question in our Support Center.