French flag Hosted and supported in France A human reply within 12 hours 06 65 13 24 36
← All articles WordPress & security7 min read

A WordPress site redirects to another site: what now?

Stop a malicious WordPress redirect, trace it in the files, the database or the scripts, and secure every point of access.

Stop a malicious WordPress redirect, find where it comes from in the files, the database or the scripts, and secure every point of access. The priority is to restore a situation under control without wiping the traces useful to the diagnosis.

Illustrated diagnosis: WordPress site redirecting to another site
Diagnosing a WordPress site redirecting to another site: symptoms, causes, fixes and checks.

How do I recognise a WordPress site redirecting to another site?

An infection is not resolved by deleting the visible file alone. You have to contain the incident, identify the point of entry, clean out every persistence mechanism, renew the secrets and then watch for files or accounts reappearing. Start by noting when it appeared, the most recent changes, the URLs concerned and the behaviour observed.

Test the site from a browser with no session, on mobile, and by arriving from a Google result: many infections only fire for certain visitors, or for crawlers. Note the suspicious URLs, the redirects you see and the Search Console warnings.

01 · Signal to check

A redirect to a domain you do not recognise

02 · Signal to check

Behaviour that only shows on mobile or when arriving from Google

03 · Signal to check

An intermittent redirect depending on the cookie

One signal alone does not prove the cause: “A redirect to a domain you do not recognise” can come from “JavaScript injected into the theme or a plugin” just as easily as from “A malicious rule in .htaccess”. Look for at least two findings that agree before you apply a lasting fix.

Where malicious redirects hide

A redirect to a spam or scam site can be triggered at several levels: rules added to .htaccess, PHP injected into index.php, wp-config.php or the theme's functions.php, JavaScript injected into the posts, or the siteurl and home options changed in the database.

Many redirects are conditional: they only fire for visitors arriving from Google, on mobile, or once per IP address. That is why the logged-in administrator often sees nothing. Test in a private window, from a phone on mobile data, and with Search Console's URL inspection tool.

Hunting for the code responsible, methodically

Compare the core files against the official release with wp core verify-checksums, then wp plugin verify-checksums --all for plugins from the official directory. Any file changed or unfamiliar — PHP files in wp-content/uploads above all — needs looking at.

In the database, look for script tags and for eval, base64_decode or String.fromCharCode in the wp_posts and wp_options tables. A redirect is almost always a sign of compromise: after cleaning up, change every password, rotate the security keys in wp-config.php, and review the administrator accounts.

Causes to check

For a WordPress site redirecting to another site, the 4 causes below are ranked from the commonest to the rarest. Test the one matching the site’s most recent change first, one at a time.

01 · Possible cause

JavaScript injected into the theme or a plugin

02 · Possible cause

A malicious rule in .htaccess

03 · Possible cause

A database option that has been changed

04 · Possible cause

A compromised administrator account or FTP access

Search Console's Security Issues report, the server access logs, the user list, the recently changed files and the scheduled tasks all give precise dates. Keep that trail: it is how you find the way in.

A good fix does not merely make the symptom disappear. It explains why the problem appeared and how to check that it does not come back.
An animated process to understand WordPress site redirecting to another site
The subject in motion: observe the facts, apply an action in proportion, then check the result.

Precautions before starting

Take a full copy of the files and the database, then keep it aside as evidence: it must not serve as a restore point until the infection is understood.

Then change the administrator, FTP, database and hosting passwords, and rotate WordPress's security keys, to close the doors the attacker could use again.

Free Host by French tool

Check where a suspicious URL really leads

Enter the URL: we follow the redirect chain from our servers to see where it finally lands.

The check queries this address directly from our servers. No data is kept.

Has an unknown redirect been confirmed on your site?

Request a clean-up
ORDER OF WORK

Diagnosis and fix

PhaseObjectiveA mistake to avoid
ObserveReproduce it and gather the evidenceChanging several settings before you have a baseline
IsolateConfirm the component or the rule responsibleDeleting files without keeping a copy
FixApply the smallest documented changeRestoring a version that still contains the same cause
ValidateTest the whole journey and monitor itConcluding from the home page loading alone

How do I resolve the problem?

The 4 steps below tackle a WordPress site redirecting to another site from the least intrusive to the heaviest. After each change, repeat the same test; if nothing changes, go back to the previous state before moving on to the next step.

  1. 01

    Step 1

    Put the site into a controlled state and keep a copy for analysis.

  2. 02

    Step 2

    Compare the core files and look for recent changes.

  3. 03

    Step 3

    Inspect .htaccess, the mu-plugins, the theme and any options holding scripts.

  4. 04

    Step 4

    Clean up, rotate every secret, then close the way in.

test from mobile, from desktop, in a private window and with several referrers.

Validate the resolution

After the clean-up, scan the files and the database again, review the administrator list, and test the redirects from several devices and from Google. Where Search Console reported a problem, request the review only once those checks are done.

Validation checks

Schedule a second integrity check a few days later: a back door you missed can reinfect the site after a clean-up that looked successful.

Prevent a recurrence

Prevention has to answer the cause you identified. For a WordPress site redirecting to another site, the first measure is “Update promptly”; note too the signal that would have shown the incident sooner, and who is responsible for watching for it.

01 · Preventive measure

Update promptly

02 · Preventive measure

Keep privileged access tight

03 · Preventive measure

Turn on file-integrity monitoring

04 · Preventive measure

Keep the backups isolated

Delete the plugins you do not use, keep administrator accounts few, turn on two-factor authentication and monitor file changes. Security rests on those layers together, not on a single plugin.

A practical diagram about WordPress site redirecting to another site
A marker specific to this article: three steps to turn reading into a decision you can verify.
FREQUENTLY ASKED QUESTIONS

Frequently asked questions

Why does the redirect not happen for me?

Many malicious redirects target only logged-out visitors, those arriving from a search engine, or those on mobile. Test in a private window, from another network, and with Search Console's URL inspection tool.

Is changing the passwords enough?

No. The malicious code stays active until it is removed, and the attacker may have added an account or a back door. Change the passwords after the clean-up, along with the security keys in wp-config.php.

Is my search ranking affected?

It can be, if Google spots the redirect: a warning in the results or a security issue in Search Console. A quick fix, followed by a review request if an issue is reported, limits the damage.

How do you check the fix will hold?

Test from mobile, desktop, a private window and several referrers. Watch for files changing after the clean-up. Check Search Console and the administrator accounts. Then watch the logs, the alerts and the relevant metrics for several days.

ON TO YOUR OWN CASE

How to resolve it

If a WordPress site redirecting to another site persists after these steps, we can pick the diagnosis up again from your logs and your access details, without acting blind on the site.

Get a diagnosis

Summary with an AI

Choose your assistant: the request is prefilled where that is possible, and always copied, ready to paste if need be.

ChatGPTSummarise the article PerplexitySummarise the article ClaudeSummarise the article CopilotSummarise the article MistralSummarise the article GeminiSummarise the article
THEY TRUSTED US

Client references

See all case studies
Montreuil-sur-Mer logo Data Labcenter logo Sofradom logo 70 Football logo Afrique sur 7 logo CyberJay logo Élisa Reddet logo Foire du Trône logo Goodyvest logo Kincy logo Lhotellier logo Audrey Mégelé du Bourg logo MYF logo
Sine Qua Non logo Make It Happen logo Sonance Audition logo ACME logo Beluvia Bar Store logo Desaltera logo Fête des Loges logo GD Menuiseries logo 3G Immo logo Lavish logo Maison du Feu logo Mieux Fiscal logo MYF Tea logo
Go deeper

Useful articles

See all articles
Illustrated diagnosis: WordPress infected after installing a plugin
WordPress security7 min read

WordPress infected after a plugin: what now?

Contain an infection that appeared after a plugin, check where it came from, clear out the persistence mechanisms and reinstall only from a source you trust.

What they say about working with us

Google reviews about the support we provide for the Wordpress site redirects to another site. page

Google logo 4,8/5 243 verifiable Google reviews Read the reviews
★★★★★
“A WordPress pro. His skills, his grasp of what we needed and his clear explanations made the whole project run smoothly.”
Nicolas Le Couteur Review published on Google
★★★★★
“Always available to answer questions, very professional. Every technical problem we ran into was resolved.”
Cuong Doan Review published on Google
★★★★★
“A professional who listens to his clients. Thank you for the commitment and the time spent on our project.”
Sakina Sedkaoui Review published on Google
★★★★★
“Someone you can trust, who understood my needs straight away and put an effective strategy in place.”
Vincent Loustalot Review published on Google
★★★★★
“Very attentive, motivated and able to propose tailored SEO strategies. The quality of the work is remarkable.”
Marine Mongodin Review published on Google
★★★★★
“Quality work, delivered on time. Maxime is responsive, suggests relevant adjustments and delivers careful work.”
Olivier Opron Review published on Google
★★★★★
“Spot on, perfect work, nothing to fault!”
Robin Gomez Review published on Google
★★★★★
“Maxime adapts very quickly, even to the trickiest technical situations. The result is always there.”
Philippe Bertieaux Review published on Google
★★★★★
“Impeccable work from start to finish, highly responsive and flawless quality.”
Alex Houillon Review published on Google
★★★★★
“The site is fast and visually very good. Maxime also helped us build our SEO strategy.”
Lois Guillermond Review published on Google
★★★★★
“An exceptional developer.”
Honoré Comlan Koumondli Review published on Google
★★★★★
“Maxime showed great professionalism and great creativity in helping us build our charity’s website.”
Julien-Benoit Birman Review published on Google
★★★★★
“A solid understanding of search optimisation when building a WordPress site.”
JM Review published on Google
★★★★★
“Maxime is responsive, a good teacher, and anticipates what is needed to get the strategy right.”
Romain Bergé Review published on Google
Your site deserves better

Let’s talk about your hosting

Tell us about your project. You get a clear recommendation, no jargon and no commitment.

Get my recommendation Reply within 12 hours • Migration handled • Free quote Active infrastructure
Google logo 243 Google reviewsVerifiable public reviews
Find my plan