Skip to main content

Server Config

Finding and Editing .htaccess Without Breaking Your Site

Locate the hidden .htaccess file in File Manager, back it up first, and add common rules for redirects, caching, and access control.

Hidden

File by default — needs Show Hidden Files enabled

Instant

A broken rule shows a 500 error immediately

Daily

Backups on top of any manual copy made before editing

24/7

Human support if a saved edit locks out the site

In short

To edit .htaccess safely, open File Manager in cPanel, enable Show Hidden Files (dotfiles) in Settings so the file appears, then download a copy or duplicate it before making any change. Edit it directly in File Manager's code editor, save, and reload the site immediately — a broken rule in .htaccess typically causes an instant 500 Internal Server Error, which is the signal to restore the backup right away.

Because a single stray character can take a whole site offline, every edit should start with that backup copy, not end with it.

.htaccess is a plain-text configuration file that Apache and LiteSpeed read on every request, and it controls things a website's own settings pages usually can't — forcing HTTPS, redirecting an old URL to a new one, blocking a specific IP address, or setting how long a browser should cache an image. WordPress writes to it automatically for permalinks, but plenty of other rules only get added by hand.

Because the file starts with a dot, it's hidden from view by default in most file browsers, and a single misplaced character inside it can take down an entire site instantly. Knowing exactly where to find it, how to back it up first, and which rules are safe to add is what separates a quick fix from an afternoon spent locked out of a broken homepage.

Finding the Hidden .htaccess File

In cPanel's File Manager, the .htaccess file normally sits in the public_html folder — or inside a specific subfolder if the site lives in an add-on domain's own directory. Because its filename starts with a dot, it won't appear in the file list until Show Hidden Files (dotfiles) is switched on under File Manager's Settings, found in the top-right corner of the screen.

If no .htaccess file exists yet — common on a brand-new site that hasn't installed WordPress or set any custom rules — one can be created directly in File Manager using New File, named exactly .htaccess with nothing after it. Apache and LiteSpeed both read it automatically the moment it exists in that folder, with no server restart required.

Backing Up Before Any Change

Right-clicking the file in File Manager and choosing Copy, then saving that copy under a name like .htaccess-backup in the same folder, takes a few seconds and is the single most important step in this whole process. Downloading a copy to a local computer as well means a fix is possible even if File Manager itself becomes hard to reach after a bad edit.

This backup habit matters because .htaccess errors don't show up gradually — a missing bracket or a typo in a rule usually produces an immediate 500 Internal Server Error across the entire site the moment the file is saved, not just on one page. Having last week's version ready to restore turns that into a thirty-second fix instead of a support ticket.

Common Rules: Redirects, Caching, and Access Control

A 301 redirect from an old URL to a new one, forcing every request to HTTPS, or setting a custom 404 error page are among the most common reasons to hand-edit this file, and each has a well-documented, standard syntax that shouldn't be improvised from memory. Browser caching rules — telling visitors' browsers to keep images or CSS files locally for a set period — also live here and can meaningfully speed up repeat visits.

Access control rules, like denying a specific IP address or blocking direct access to a sensitive folder, follow the same file and the same caution. Each block of rules should be added one at a time, with a save and a reload of the site in between, rather than pasting in five new rules at once and hoping none of them conflict.

Recovering From a Broken .htaccess

If the site shows a 500 Internal Server Error immediately after saving, the fastest fix is reopening File Manager, deleting or renaming the broken .htaccess, and restoring the backup copy made earlier — this brings the site back within moments. If no backup exists, simply renaming the file to something like .htaccess-old and letting the CMS in use regenerate a fresh default one on its next permalink save often restores basic functionality.

If File Manager itself won't load because the error is severe enough to affect the whole account's interface, that's the moment to contact support directly rather than keep guessing at the syntax — a human can access the file through a different route and get the site back up while the actual rule gets debugged properly.

How to Edit the .htaccess File Safely

A Safety Net for Every .htaccess Edit

Daily backups on Hosting Cheap mean a broken .htaccess is never more than a restore away, even on the days a manual copy wasn't made first — though making one is still the faster fix.

The cPanel-style File Manager includes hidden-file visibility and a built-in code editor, so finding, backing up, and editing .htaccess never requires FTP software or a separate tool just to see the file.

  • cPanel-style File Manager with hidden-file visibility built in
  • Daily backups as a fallback beyond any manual copy
  • 24/7 human support if a broken rule locks out the site
  • Pure NVMe SSD + LiteSpeed so saved changes take effect fast

Why Hosting Cheap

What you get

Built-In Hidden File Access

File Manager's Show Hidden Files setting reveals .htaccess without extra software.

Daily Backups

A restore point beyond any manual backup, in case an edit goes unnoticed for a while.

24/7 Human Support

Real help getting a site back online if a rule causes a 500 error.

LiteSpeed + NVMe SSD

Rule changes, including caching directives, take effect on fast, modern infrastructure.

Free Managed Migration

Existing .htaccess rules move over intact when a site is migrated to Hosting Cheap.

30-Day Money-Back Guarantee

Test hosting and its file management tools risk-free for a full month.

How It Works

Get set up in a few steps

1

Enable hidden files and locate .htaccess

Turn on Show Hidden Files in File Manager Settings to reveal .htaccess in public_html.

2

Back up the current file

Copy or download the existing .htaccess before changing anything, in case a restore is needed.

3

Add one rule at a time and test

Edit, save, and reload the site after each change rather than pasting in several rules at once.

Included

Everything you need, on every plan

  • Enable Show Hidden Files (dotfiles) in File Manager Settings first
  • Copy the existing .htaccess and rename the copy before editing
  • Download a local copy in case File Manager becomes hard to reach
  • Add or change one rule at a time, not several at once
  • Reload the site immediately after saving to catch errors early
  • Check for a 500 Internal Server Error right after saving a change
  • Restore the backup copy immediately if the site goes down
  • Contact support if File Manager itself won't load after a bad edit

FAQ

Frequently asked questions

Why can't I see the .htaccess file in File Manager?

Its filename starts with a dot, which most file browsers, including cPanel's File Manager, hide by default. Turning on Show Hidden Files (dotfiles) under File Manager's Settings menu reveals it immediately in the public_html folder or the relevant site subfolder.

What happens if I make a mistake editing .htaccess?

A syntax error in the file typically causes the entire site to show a 500 Internal Server Error the moment it's saved, rather than a gradual or partial failure. Restoring a backup copy of the previous working version fixes this almost instantly.

Should I back up .htaccess before every single edit?

Yes. Because errors in this file take the whole site down immediately rather than warning first, copying the current version before any change — even a small one — is the difference between a thirty-second fix and an emergency.

Can I create a .htaccess file if one doesn't already exist?

Yes — using New File in cPanel's File Manager and naming it exactly .htaccess creates one that Apache and LiteSpeed will read automatically, with no server restart needed for it to take effect.

Will editing .htaccess manually conflict with WordPress permalinks?

It can, since WordPress writes its own rewrite rules into this file automatically when permalink settings are saved. Adding custom rules outside the block marked for WordPress, and re-saving permalinks afterward to confirm WordPress's own rules are still intact, avoids most conflicts.

What's the fastest way to fix a site after a bad .htaccess edit?

Reopen File Manager, delete or rename the broken file, and restore the backup copy made before editing — this typically brings the site back within moments. If no backup exists, renaming the file so the CMS regenerates a default version, or contacting support directly, are the next options.

Edit Server Config With a Safety Net Underneath

Daily backups and 24/7 human support mean a risky .htaccess edit is never a real gamble.

Get Started