21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

Where Is the .htaccess File in cPanel?

Quick answer

In cPanel, the .htaccess file is in the site's document root: public_html for the main domain, or the folder listed under Domains for an addon domain or subdomain. File Manager hides it because the name starts with a dot; open Settings, tick Show Hidden Files (dotfiles) and save. If it still does not appear, create it.

For cPanel users who need to open, create or repair .htaccess to add a redirect, fix permalinks or undo a 500 error.

✓ In business since 2005
✓ INR + GST billing
✓ 24/7 Email Support — avg reply < 60 min
GuideWebJi®
knowledge
Read time
4 min
Sections
7
Updated
14 Nov 2026
Written by
WebJi® team

Where is the .htaccess file in cPanel?

The .htaccess file for a website sits in that site's document root: public_html for the primary domain, and the folder shown under cPanel → Domains for each addon domain or subdomain. Subfolders can hold their own .htaccess, which applies only to URLs inside that folder.

Which .htaccess controls which site in a cPanel account
Site or pathFile to openHow to confirm
Primary domain/home/user/public_html/.htaccessDomains lists the document root as public_html
Addon domain or subdomain.htaccess in its own document root, e.g. public_html/shop.example.in/Domains → Document Root column
App in a subfolder (e.g. /blog/)public_html/blog/.htaccess, plus the parent fileRules in the deeper file win for that folder
Password-protected folder.htaccess inside that folder (with a separate password file)Created by cPanel Directory Privacy

Because an addon domain's folder often sits inside public_html, its requests can also be affected by the primary domain's .htaccess. When a rule seems to "leak" into another site, that parent file is usually why.

How to show hidden files in cPanel File Manager

Open File Manager, click Settings at the top right, tick "Show Hidden Files (dotfiles)" and click Save; .htaccess then appears in the file list if it exists. Linux treats every name starting with a dot as hidden, and File Manager follows that convention by default.

  1. Log in to cPanel and open Files → File Manager.
  2. Click Settings in the top-right corner.
  3. Tick Show Hidden Files (dotfiles) and click Save.
  4. Open the document root from the table above; the list reloads with dotfiles such as .htaccess and .well-known.

FTP clients such as FileZilla hide dotfiles too; enable "Force showing hidden files" in its Server menu. File Manager's other tools are covered in the cPanel File Manager guide.

Finding every .htaccess file in the account over SSH

If your plan includes SSH or cPanel's Terminal, one find command lists every .htaccess in the account, which is the fastest way to spot a stray file in a subfolder.

# show hidden files in the web root
ls -la ~/public_html

# list every .htaccess under your home directory
find ~ -name ".htaccess" -type f 2>/dev/null

# show the active rule lines, skipping comments
grep -v '^#' ~/public_html/.htaccess

Plugins and old installs often leave .htaccess files in wp-content/uploads/, cache folders or abandoned subfolders. Each one is read for requests in its folder, so a forgotten file can block images or scripts long after the plugin is gone.

Which cPanel tools write to .htaccess for you

Several cPanel features edit .htaccess automatically, which is why the file can appear or change without you opening it. Recognising their marked blocks stops you deleting a line the panel depends on.

  • MultiPHP Manager: adds a "cPanel-generated handler, do not edit" block that selects the PHP version; see changing the PHP version in cPanel.
  • Redirects: writes RewriteRule or Redirect lines for each redirect you create.
  • Hotlink Protection: adds referrer checks that block other sites embedding your images.
  • Directory Privacy: creates a .htaccess in the protected folder pointing at a password file.
  • WordPress and other CMSs: write their own block, for example between # BEGIN WordPress and # END WordPress.

What to do if the .htaccess file does not exist

If hidden files are visible and there is still no .htaccess, nothing has created one yet; make it with + File, named exactly .htaccess, in the correct document root. A plain HTML site or a fresh WordPress install with plain permalinks may never have needed one.

For WordPress, let WordPress write it: go to Settings → Permalinks and click Save Changes. If it cannot write the file, paste the standard block yourself:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Set the file permission to 644. Watch for Windows editors that save it as .htaccess.txt; the server ignores that name.

Editing .htaccess safely, and undoing a 500 error

Copy the file to .htaccess.bak before every edit, change one thing at a time, and test in a private window; a single typo returns HTTP 500 for every page in that folder.

  • Back up: right-click → Copy → name it .htaccess.bak, and download a second copy.
  • Edit: right-click → Edit, make the change, Save Changes, reload the site.
  • If the site shows 500: rename .htaccess to .htaccess.off. If the site returns, the file was the cause; restore the backup and redo the change carefully.
  • If Edit fails with a security-token error: log out and back in; if it persists, the file may belong to another user, so contact support.

Other causes of a 500 are covered in 500 errors on cPanel hosting. Once you have the file open, the .htaccess guide explains the common rules, .htaccess 301 redirects covers redirects, and the .htaccess generator builds tested snippets.

When .htaccess has no effect at all

.htaccess is read only by Apache and LiteSpeed; on a server where Nginx serves the site directly, the file is ignored and rules belong in the Nginx server block. On Apache itself, rules also do nothing if the server's AllowOverride setting is None for that directory, which only the server administrator can change. WebJi® cPanel hosting reads .htaccess in every document root; if a rule still seems ignored, email support@webji.services with the domain and the lines you added.

FAQ

Frequently asked questions

Can I have more than one .htaccess file?

Yes. Each folder can have its own. The server applies the files from the document root down to the folder being requested, and a deeper file can override or add to rules from its parents for URLs inside it.

Is there a .htaccess file in my home directory above public_html?

Usually not, and a file there would not control the website, because the web server starts reading from the document root. Edit the one inside public_html or the addon domain's folder.

Why did my .htaccess changes disappear?

Something rewrote the file: saving WordPress permalinks replaces everything between its BEGIN and END markers, and cPanel tools rewrite their own blocks. Put custom rules outside those marked blocks, above the WordPress section.

What permission should .htaccess have?

644: readable by the web server, writable only by your account. A file set to 777 or owned by another user can cause a 500 error or a security warning on many servers.

Last editorial update: 14 November 2026.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.