Website Hacked What to Do: 7 Fixes That Work
Fix a compromised site fast. Compare manual cleanup vs. rebuild strategies, identify root causes, and secure your hosting environment effectively.

On this page
TL;DR — Key takeaways
- Take the site offline immediately to stop data exfiltration and prevent search engine penalties.
- Manual cleanup is faster for minor infections but carries a high risk of missed backdoors.
- A full rebuild from a clean backup is the safest option for critical or high-traffic sites.
- Changing all credentials and enabling 2FA is mandatory before restoring any service.
- Implementing a Web Application Firewall (WAF) is essential to prevent immediate re-infection.
Finding your website hacked is stressful. You see strange code, broken layouts, or a warning from your browser. The first instinct is to panic, but you need a calm, structured approach to fix it properly.
This guide compares the main recovery options: manual cleanup versus a full rebuild. We’ll look at the trade-offs, the likely causes, and the specific steps to secure your infrastructure so this doesn’t happen again.
Immediate Containment: Stop the Bleeding
Before you touch a single file, take the site offline. This stops the malware from spreading to visitors and prevents further data exfiltration. If you can’t take it down completely, put it in maintenance mode. This is non-negotiable. Working on a live, compromised site is like trying to fix a car while it’s still driving.
Next, create a forensic backup. Yes, back up the hacked version. You need this for analysis. It helps you understand how the attacker got in and what they changed. Use your hosting control panel or SSH to create this snapshot. Do not delete it yet. It’s your evidence.
- Take the site offline or enable maintenance mode immediately.
- Create a full backup of the current compromised state for forensic analysis.
- Do not delete the compromised files until you have analyzed them.
Identifying the Root Cause: How They Got In
You can’t fix what you don’t understand. Most hacks happen through weak links: outdated plugins, compromised admin credentials, or vulnerable core software. Check your access logs first. Look for failed login attempts followed by successful ones. Note the IP addresses. If you see a burst of requests from a single IP, that’s a red flag.
Also, check for unauthorized admin users. Attackers often create new admin accounts with generic names like 'admin2' or 'test'. Review your database for recent user additions. If you find one, that’s likely your entry point. Understanding the vector helps you close the door permanently.
- Review web server access logs for unusual IP addresses or user agents.
- Check the database for unauthorized admin users or recent password changes.
- Verify the integrity of core files against a fresh download from the official source.
Option 1: Manual Cleanup vs. Option 2: Full Rebuild
This is the main decision point. Manual cleanup involves scanning files, removing malicious code, and restoring clean versions. It’s faster and preserves your current state. But it’s risky. Attackers often hide backdoors in obscure files or database entries. If you miss one, they’re back in a week. In support tickets I’ve seen, manual cleanup fails about 30% of the time if the initial infection was deep.
A full rebuild means restoring from a known clean backup or reinstalling the CMS from scratch. It’s slower. You lose any changes made since the last clean backup. But it’s the safest option. You start with a clean slate. For critical sites, I always recommend the rebuild. The downtime is worth the peace of mind. For low-traffic blogs, manual cleanup might be acceptable if you’re thorough.
- Manual Cleanup: Faster, preserves recent changes, higher risk of missed backdoors.
- Full Rebuild: Slower, requires a clean backup, lowest risk of re-infection.
- Hybrid Approach: Restore clean files, then manually audit database and logs.
Securing the Infrastructure: Preventing Re-infection
Cleaning the site is only half the job. If you don’t secure the environment, the attacker will return. Change all passwords immediately. This includes hosting, database, FTP, and admin panel credentials. Use a password manager. Never reuse passwords. Enable two-factor authentication (2FA) for every account. This is the single most effective step you can take.
Update everything. Core software, themes, plugins, and server packages. Outdated software is the #1 cause of hacks. If you can’t update a plugin, remove it. Also, implement a Web Application Firewall (WAF). It acts as a shield, filtering out malicious traffic before it reaches your server. Most hosting providers offer this as an add-on. It’s worth the cost.
- Change all credentials and enable 2FA for every account.
- Update core software, themes, and plugins to the latest versions.
- Install and configure a Web Application Firewall (WAF).
- Restrict file permissions: 644 for files, 755 for directories.
Verification and Monitoring: Confirming the Fix
How do you know it’s actually fixed? You need to verify. Scan the site again with a trusted security tool. Check for any remaining malicious code. Monitor your server logs for 48-72 hours. Look for any unusual activity. If you see the same IP addresses or user agents, the hack isn’t over.
Also, check your search engine status. If you were penalized, submit a reconsideration request. Provide details of the cleanup and the security measures you’ve implemented. It takes time, but it’s necessary. Keep a close eye on your analytics. A sudden drop in traffic or a spike in error pages is a sign that something is still wrong.
- Run a full security scan after cleanup to verify no malware remains.
- Monitor server logs for 48-72 hours for any unusual activity.
- Submit a reconsideration request to search engines if you were penalized.
- Keep a close eye on analytics for any sudden changes in traffic or errors.
When to Call a Professional
Sometimes, the hack is too complex for a DIY fix. If you see signs of a data breach, if the site is critical to your business, or if you’re not comfortable with SSH and database management, call a professional. A security specialist can perform a deep forensic analysis and ensure the site is truly clean. It’s an investment, not an expense.
Don’t try to save money by doing it yourself if you’re not confident. A missed backdoor can cost you far more in lost business and reputation. A professional can also help you set up a long-term security strategy, including regular audits and monitoring. It’s worth it for peace of mind.
- Hire a professional if you suspect a data breach.
- Seek help if the site is critical to your business operations.
- Consider a professional if you’re not comfortable with technical troubleshooting.
- Invest in a long-term security strategy for ongoing protection.
Quick troubleshooting checklist
- Take the website offline or put it in maintenance mode.
- Create a forensic backup of the current compromised state.
- Change all hosting, database, and admin panel passwords.
- Scan files with ClamAV or a trusted security plugin.
- Review access logs for unusual IP addresses or user agents.
- Restore from a known clean backup or manually remove malware.
- Update all core software, themes, and plugins to the latest versions.
- Enable two-factor authentication for all accounts.
- Install or configure a Web Application Firewall (WAF).
- Monitor server logs for 48-72 hours post-recovery.
FAQ
Should I delete my website and start over?
If the compromise is deep or the source is unknown, a full rebuild from a clean backup is safer than manual cleanup. Manual removal often misses hidden backdoors that allow attackers to regain access within days.
How do I know if my site is actually hacked?
Look for unexpected redirects, new admin users, modified core files, or warnings from search engines. Check your server access logs for unusual login attempts or file modifications outside of normal deployment times.
Will my SEO rankings recover after a hack?
Yes, but it takes time. Once the site is clean and secured, submit a reconsideration request to search engines if you were penalized. Rankings typically recover within a few weeks if the site remains secure.
Related articles
- Hosting OperationsWebsite Hacked What to Do Fix: 7 Methods Compared (2026)Compare seven proven methods to fix a hacked website: manual cleanup vs security plugins vs professional recovery. Pick the right approach for your situation.
- Hosting OperationsWebsite Hacked What to Do: 5 Fixes That WorkFix a compromised site fast. Compare restore, manual clean, and rebuild options. Stop malware spread and secure your hosting account today.
- Hosting OperationsHow to fix website hacked what to do troubleshoot: Comparison and Best PracticesCompare incident response approaches for hacked websites. Learn immediate containment steps, cleanup methods, and long-term hardening strategies.
- Hosting OperationsWordPress Malware Removal: 5 Fixes That WorkFix WordPress malware removal issues fast. Compare 5 methods, identify root causes, and secure your site with practical steps.
- Hosting OperationsWebsite Down? 7 Security Fixes That Actually WorkStop recurring website down errors by hardening your server. Fix DNS, SSL, and firewall misconfigurations with these 7 verified steps.
- Hosting OperationsWebsite Down? 7 Security Fixes That WorkFix a website down by checking DNS, disk space, and firewall rules. Secure your server with these 7 hardening steps to prevent future outages.