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?

Login to comment.

Your Opinion Matters

... but we need to know what you're thinking!

I'm Christi Nickerson, your friendly Community Support technician, and I wrote the article you're looking at now. I like to think it's perfect, but I'm sure you have some suggestions. Please, let me know what they are!

Feedback
Your Email Address
Because we'd like to talk with you!

Have a Question?

If you need some help, submit your question to our Community! We guarantee a response within 60 minutes (8am - 9pm EST, Monday - Friday)

Recent Questions

  1. Site under brute force attack
  2. URLs in Installation of WordPress Don't Redirect
  3. Choosing a Directory With WordPress

Support Center Search

Current Customers

Email: support@WebHostingHub.com 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.