Quick answer
When a website goes down or is hacked, first isolate it (do not delete anything), determine the exact time of the incident and find a backup created before that moment. Then restore files and database from backup, verify integrity, reset passwords and only then put the site back online.
How to recognize the problem
- Website shows a 500 error, white screen or database error message
- Unknown links, ads or pages you did not create appear on the site
- New administrator accounts or unknown files appear in the directory
- Google shows a dangerous site warning or the site is removed from the index
- Hosting suspended the account due to suspicious activity or resource overuse
Most common causes
Compromised administrator password
A weak or reused password allows an attacker to log in as administrator and change content or install malicious code.
Outdated plugin or theme
Vulnerable plugins and themes (especially those not updated) are the most common entry point for attacks on WordPress and similar systems.
Configuration or update error
A failed update, incorrectly modified file or plugin conflict can bring down a site even without an attack.
Hosting problems
Server or database failure, or resource overuse, can cause website unavailability even if the site is not hacked.
Malicious code on your computer
If you log in to the site from an infected computer, credentials can be stolen and the site compromised.
Step-by-step fix
- 1
Isolate the site and preserve evidence
Do not delete files or reinstall. If the site is hacked, switch it to maintenance mode or temporarily disable public access. Save a copy of the current state (files and database) for analysis, then change access credentials (FTP, database, administrator account) as soon as possible.
- 2
Determine the time of the incident
Review the access log and error log on the hosting (usually in the control panel, e.g. cPanel or Plesk, in the logs or statistics section, or in the log directory specified by your hosting). Note the date and time when suspicious activities or errors appeared. This is crucial for choosing a backup created before that moment.
- 3
Find the appropriate backup
In the hosting panel, look for the backup section (e.g.
BackuporBackup Wizard). If the hosting makes automatic daily backups, choose the one from before the incident. If you do not have a hosting backup, check if you have your own copy (backup plugin, manual export of database and files). - 4
Restore website files
Via FTP or the hosting file manager, rename the current site directory (e.g.
public_htmltopublic_html_old) and unpack the backup archive. Do not delete the old directory until you verify everything works. Be careful not to overwrite configuration files if they are not part of the backup. If possible, first restore the site to a local development environment for verification. - 5
Restore the database
In the database panel (e.g. phpMyAdmin), create a new database or, if using an existing one, first export it. Then, if necessary, delete existing tables and import the
.sqlfile from the backup. If the table prefix differs, adjust the site configuration. Verify that all tables were imported without errors. - 6
Verify integrity and remove malicious code
Compare website files with the original version (e.g. by re-downloading WordPress core and themes). Check
wp-config.php,.htaccessand the uploads directory for suspicious files. If you find unknown files or code, isolate them (rename or move outside the public directory) and note the paths. - 7
Reset passwords and keys
Change the password for the hosting panel, FTP, database and all administrator accounts on the site. In WordPress, replace the
SALTkeys inwp-config.phpwith new values (e.g. using the generator atapi.wordpress.org/secret-key/1.1/salt/). Remove unknown users; changing SALT keys will log out all active sessions. - 8
Update everything and put the site back online
Update core, themes and plugins to the latest versions, remove unnecessary plugins and themes. Verify that the site works correctly, then return it to public mode. Monitor logs for the next 24 hours.
- 9
Report the issue and clean up reputation
If the site was on Google's dangerous sites list, submit a request for review in Google Search Console. If the hosting suspended the account, contact support explaining what you did. Check if emails were compromised and notify users if there was a data breach.
If nothing helps: advanced check and isolation
If the problem returns even after restoring from backup, malicious code may remain in the database (e.g. in options, posts or users) or in files outside the standard directory. Then do the following: make a completely new installation on clean hosting, import only content (posts, pages, media) from a verified copy, and install themes and plugins from official sources. Be sure to scan the computer you log in from. If the site was compromised for a long time, contact a specialized forensics service or hosting support that can review server-level logs.
How to prevent it
- Regularly make backups (files and database) and store them off-hosting, at least 30 days back.
- Update core, themes and plugins immediately, and remove everything you do not use.
- Use strong, unique passwords and two-factor authentication for administrators and the hosting panel.
- Monitor logs and set up notifications for failed logins and file changes.
When to call a professional
If the site contains sensitive user data, if it was compromised for a long time, or if the problem repeats even after multiple restoration attempts, contact an IT expert or a specialized website security service.
Website development · Fast, SEO-ready, multilingual websitesFAQ
How often should I back up my website?
For frequently changing sites, a daily automatic backup is recommended, and a manual one before every major change (update, plugin installation). Keep at least a week of daily and several monthly backups.
Can I restore only the database if the site was hacked?
Sometimes it is enough to restore the database if malicious code is only in it, but often files are also modified. The safest is to restore both files and database from the same backup, then verify integrity.
What if I have no backup and the site is down?
Contact hosting support and ask if they keep backups. If not, manual repair or building a new site remains. That is why regular backup is crucial.