Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

How-to

How to stop yourself deleting .htaccess by mistake

FTP by Zaweba blocks moves, renames, deletes and permission changes on .htaccess, wp-config.php, .env and other protected paths unless a site option allows it.

How to stop yourself deleting .htaccess by mistake

This is already done for you in FTP by Zaweba. A .htaccess file is one of its protected paths, along with wp-config.php, .env and a handful of folders, and the app blocks them from being moved, renamed, deleted or given new permissions. You don't need to switch anything on. A site option can allow changes to them, but it's off unless you choose it and isn't recommended.

So the real job is understanding what's protected, what the app shows you when it steps in, and what to do on the rare occasion you mean to change one.

Why these files matter

A .htaccess file tells an Apache web server how to behave for its folder: redirects, rewrites for tidy addresses, access rules and more. Delete it and a site can lose its pretty links, its HTTPS redirect or its protection on private folders, often without an obvious error. Rename it and the effect is the same.

wp-config.php holds a WordPress site's database settings. Without it the site stops. A .env file often holds similar settings and keys for other kinds of app. Folders such as .well-known/ are used by services like certificate checks, and cgi-bin/ and the cPanel folders (mail/, etc/, ssl/, logs/) belong to the hosting account itself. The web root is protected too, so the whole site can't be moved or deleted in one slip.

All of these share a trait: they're easy to remove by accident during a tidy-up, and the damage may not show until much later.

What you'll see when it steps in

If a batch you've selected includes a protected item, the confirmation lists it as left out. Everything else goes ahead, and the protected file stays exactly where it was.

A folder that merely contains a protected file isn't itself blocked. You can still move or delete it, but the confirmation tells you there's a protected item inside, so you have a chance to think again.

Disk, the app's view of server space, follows the same rules for its bulk rename, move, trash and permission tools, and leaves protected items out of those too.

When you really do need to change one

Editing is different from deleting. You can open .htaccess from the server pane in the code editor, which has Apache .htaccess syntax colouring, make your change and save. Before anything is overwritten, the previous version is kept in local version history on your PC, so a bad edit can be compared and restored.

If you genuinely need to move, rename, re-permission or delete a protected item, there's a site option in Site Manager that allows Disk to change them. Turn it on, make the change, and turn it off again straight away. Leaving it on removes the guard rail for every later clean-up on that site.

Other habits that help

Keep your local copy of .htaccess in step with the server. Then, even if something did happen to the live one, you'd have a good copy to put back. Compare with Server Copy on the right-click menu shows any difference line by line.

Use the ordinary delete rather than Delete Permanently when tidying. Server deletes can go to a server-side trash, so a slip with an unprotected file can still be undone from the Trash window.

Batch confirmations can offer to download a backup before deleting. On a large clean-up, take it. Between the protected paths, the trash and local history, FTP by Zaweba makes it hard for one wrong click to take a site down.