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.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.