01Services02AI03Sectors04Servers05Contact
Discuss your project

Or on WhatsApp: +216 54 166 821

Guide

Website hacked: what to do, step by step

A strange page on your site, a warning from Google, emails sent without your knowledge. Do not panic: here is the order in which to act.

By , senior full-stack developer, XAB Solutions · Updated October 27, 2026

In short

If your website is hacked, start by changing every password (hosting, administration, database, email), put the site in maintenance mode and keep a copy of its current state to understand the attack. Then clean it from a clean backup or by removing the modified files, and fix the hole that let the attacker in, otherwise the hack will come back. Finally, ask Google for a review if a warning is shown.

How do you know if your website has been hacked?

A hacked site is most often spotted through behaviour you did not program.

  • Unknown pages in Google, often in a foreign language or about unrelated products
  • A redirect to another site, sometimes only on phones or when coming from Google
  • A “dangerous site” warning in the browser or in search results
  • Administrator accounts you did not create
  • A host reporting mass email sending or suspending the account
  • A site that is suddenly very slow, or files recently changed for no reason

Some hacks are invisible to you and only show to visitors coming from Google. Check from another device.

What should you do in the first hour?

In the first hour, the goal is to cut off the attacker's access and preserve the traces.

Change every password from a clean device: hosting, site administration, database, FTP, the email linked to the domain. Delete unknown administrator accounts. Put the site in maintenance mode if visitors are being redirected or if customer data is at stake.

Before deleting anything, make a full copy of the files, the database and the server logs. It helps you understand how the attacker got in. Tell your host: they often have useful information.

A question about your case? We answer on WhatsApp, with no commitment.

Request a quote

How do you clean a hacked website?

The safest clean-up is to start again from a clean base rather than hunting for each infected file by hand.

If you have a backup from before the hack, restore it, then reapply the changes made since. Otherwise, reinstall the site core and plugins from their official sources, then compare the remaining files with a clean version. Check the database: attackers often hide code or links in it.

Cleaning is useless if the hole stays open. You need to find the entry point: an outdated plugin, a weak password, a poorly protected form, a badly configured server. Without this step, the site is often hacked again within days.

Why are WordPress sites targeted so often?

WordPress is targeted mainly because it is so widespread, which lets attackers hit thousands of sites with the same automated tool.

The WordPress core is closely watched. The risk most often comes from plugins and themes that are not updated, or from pirated versions of paid themes downloaded from dubious sites, which sometimes already contain malicious code.

A custom site is not immune either: a poorly protected form or a server that is never updated are also ways in. What protects you is regular upkeep, whatever the tool.

How do you stop a hack from happening again?

A handful of habits is enough to keep out the vast majority of automated attacks.

  • Regular updates of the site, plugins and server
  • Removal of unused plugins and themes
  • Unique passwords and two-factor authentication for administration
  • Automatic backups, stored somewhere other than the server, and tested
  • Separate accounts for each person, with only the rights they need
  • Monitoring: an alert if the site changes or goes down

A maintenance contract covers these points for you if nobody in-house has time to deal with them.

Official sources

Frequently asked questions

Your other questions.

Google shows a warning on my site, what should I do?

First clean the site and fix the hole. Then, in Google Search Console, open the security issues section and request a review, explaining what was done. The warning disappears once Google has validated it.

Is a backup enough to fix everything?

It lets you get back a clean site, but it does not close the hole. You also need to check that it dates from before the hack, because some attackers stay quiet for weeks.

Could my customers' data have leaked?

It is possible if the site stores accounts, orders or forms. The server logs and the copy made at the start help you find out. If so, look into your obligations towards your customers before communicating.

A project, an idea, a problem with your website?

Describe it in a few lines. You receive a clear quote within 24 hours.