What to do if your website has been hacked: emergency steps and recovery

Website compromised with security notice

You open your website and it isn't your website. Strange adverts appear, you're redirected to another page, Google warns that "this site may be hacked" or a customer emails you because they've been hit with an alert. Breathe: it can almost always be fixed. But what you do in the first hour makes the difference between a scare and weeks of problems.

The urgent bit, in one line

Put the site into maintenance mode, change every password from a clean device, tell your hosting provider and don't delete anything until you know how they got in.

Signs your website has been hacked

  • It redirects to betting sites, pharmacies, adult content or fake shops, sometimes only on mobile or only when arriving from Google.
  • Google shows warnings in the results such as "This site may be hacked", or the browser blocks entry with a red screen.
  • Pages, users or posts appear that you didn't create.
  • Your email starts bouncing or your customers receive emails you didn't send.
  • The site is suddenly very slow or your hosting provider warns you of abnormal usage.
  • Search for yourself on Google with site:yourdomain.com and you see titles in Japanese, Chinese or for products you don't sell.

Step 1. Stop the damage (first 15 minutes)

  1. Put the site into maintenance mode or ask your hosting provider to suspend it temporarily. Better a site closed for a few hours than a site sending your customers to a scam.
  2. Change your passwords from another device, not from the computer you usually log in with, in case it's infected: website panel, hosting, FTP, database and email.
  3. Check the administrator users and remove any you don't recognise.
  4. Turn on two-factor authentication for access to the website and the hosting.

Step 2. Tell whoever needs to know

  • Your hosting provider: they can see how they got in and they hold copies of the server.
  • Whoever maintains your website, if you have someone.
  • INCIBE on 017, the free and confidential cybersecurity helpline, for guidance.
  • If you have an online shop or forms with customer data and you think they may have seen it, you may have to report it to the Agencia Española de Protección de Datos within 72 hours. Get advice.
Reviewing and cleaning a hacked website step by step

Step 3. Clean up, don't patch

The most common mistake is deleting whatever looks odd and carrying on as if nothing happened. Attackers usually leave a "back door" so they can get back in. A proper clean-up includes:

  • Restoring a clean backup, from before the attack, if you have one. It's the quickest and safest route.
  • If there's no backup: reinstall WordPress, the theme and the plugins from their official source and check files and the database for added code.
  • Delete plugins and themes you don't use, and any downloaded from "free" sites that aren't the official ones.
  • Update everything to the latest version before reopening.
  • Find out how they got in: an outdated plugin, a weak password, access belonging to a former supplier… If you don't close that door, it'll happen again.

Step 4. Win back Google's trust

  1. Go to Google Search Console and check the Security issues section.
  2. If Google has flagged your site, once it's clean click Request review explaining what you've done.
  3. Check with site:yourdomain.com that no junk pages remain indexed and remove any that still appear.

The sooner you do it, the fewer positions you lose. A site flagged as dangerous can lose its Google visits within days.

Backups and user control in WordPress

Step 5. Make sure it doesn't happen again

  • Automatic backups stored off the website's server, and checked from time to time.
  • Updates for WordPress, theme and plugins as soon as they're released, especially security ones.
  • Protected access: two-factor authentication, unique passwords and lockout after several failed attempts.
  • Monitoring: someone who checks the site every week and gets the alerts before your customers do.

To make sure it doesn't happen again, read our cybersecurity guide for small businesses: the 10 basic measures to protect your business.

Frequently asked questions

Will I lose my search rankings if my website is hacked?
You can lose visits while Google has it flagged or indexes junk pages. If it's cleaned quickly and a review is requested, it's usually recovered.

Is restoring a backup enough?
It's the best first step, but if you don't close the door they came through, they'll be back. You need to update and change access details after restoring.

Doesn't my hosting provider take care of this?
Hosting protects the server, but it's usually not responsible for what's inside your website: plugins, users and passwords are down to you or whoever maintains it.

How long does it take to clean up?
With a clean backup, it can be sorted in hours. Without a backup and with a lot of infected code, it can take days.

Alcoyinnova · Security and recovery

Has your website been hacked?

We clean it up, close the door they came in through and keep it guarded with backups. We're from Alcoy: we're right on your doorstep.

Urgent help via WhatsApp See maintenance and security