Exposed Files on Your Website: .git, .env, Backup Zips and Test Pages
Leftover files can leak passwords and source code. Search for them and remove or block them.
Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Look for
/.git/,/.env,/wp-config.php.bak,/backup.zip,/database.sqlphpinfo.php,test.php, old copies of the site,/error_log
What to do
- Open the addresses in a browser to confirm what is public.
- Delete files you do not need. Move needed backups out of the web root.
- Block sensitive patterns with server rules.
- If a secret was exposed, change it: database password, keys, salts.
- Disable directory listing. See WordPress Site Shows a Directory Listing or Index Of Page.
Check the logs for downloads of these files. See finding error logs.
Related guides
- WordPress User Can't See Posts They Created: Roles and Permissions
- WordPress Site Health Warnings: What To Fix First
- WordPress: Create a New Admin User via Database When Locked Out
- WordPress Automatic Updates: Enable, Disable and Safe Settings
Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.