Skip to content

Home  /  Blog  /  Security

Why Is My WordPress Site Redirecting to Another Website?

A WordPress site that redirects visitors to another website is usually infected with malicious code, though a misconfigured plugin, a changed site address or a faulty redirect rule can also be responsible. Because redirects can be hidden from the owner, it is important to confirm the cause before cleaning up.

5 min readSecurityWritten by WP Mate, Warrnambool VIC
WP Mate koala mascot beside a laptop, representing Australian WordPress support
01

Redirects: harmless or harmful?

Redirects are normal. Websites use them to send old addresses to new ones. A problem arises when visitors are sent somewhere you did not choose. Malware often does this selectively, for example only for visitors arriving from Google or on mobile phones, which is why the owner may never see it.

02

Common causes

CauseNotes
Malicious code in filesInjected into theme, plugin or core files
Malicious code in the databaseInjected scripts in posts, widgets or settings
A tampered .htaccess fileRedirect rules added at the server level
A compromised plugin or themeOften nulled or outdated software
A redirect plugin or settingLegitimate rules that are wrong or out of date
Changed site or home URLWordPress settings pointing to another address
DNS or hosting changesThe domain is pointing somewhere else

Not sure what is going on with your website?

Tell us what you are seeing and we will outline the next step before any chargeable work.

03

Checks that help

  • Test from a different device and network, and from a Google search result
  • Check Settings, General for the correct site and home addresses
  • Look at recently changed files and unknown administrator accounts
  • Check for redirect plugins and rules you did not set up
  • Review what search results show for your domain
04

Why cleaning one file is rarely enough

Redirect malware is frequently planted in several places so it returns after a partial clean-up. Effective removal needs the entry point closed, credentials changed and the site scanned again. See signs your WordPress website has been hacked for the wider picture.

05

Conditional redirects: why you might not see it

Redirect malware often checks who is visiting. It may redirect only visitors who come from a search engine, only mobile users, only first-time visitors or never the logged-in administrator. If you type your address directly into a browser you might see a perfectly normal website while customers are being sent away. Testing from a search result link, on mobile data and in a private window gives a truer picture.

06

Where the redirect code hides

LocationWhy attackers use it
Theme files such as header or functionsRuns on every page
Plugin files, including inactive pluginsOften forgotten and unmonitored
The .htaccess fileActs before WordPress even loads
The database in posts or widgetsSurvives a file clean-up
The uploads folderLooks like harmless media
07

After clean-up: verifying it is really gone

Verification means rescanning files, checking users, reviewing the .htaccess file, testing from several devices and monitoring for return. It also means closing the entry point: updating the vulnerable component and changing credentials. Without those steps, a clean site can be reinfected within days. Our recovery process covers all of them.

08

Can I fix a redirect myself?

If the cause is a harmless misconfiguration, such as a wrong site address or a leftover redirect rule, a careful owner can sometimes fix it. If the cause is malware, a do-it-yourself clean-up is risky. Removing visible code often leaves hidden copies, and mistakes can break the site. The safe approach is to make a backup of the affected state, avoid further changes and have the site assessed. A professional can tell harmless from harmful quickly and explain the options.

09

What to expect from an assessment

An assessment reviews files for known malicious patterns, compares core files with clean versions, checks the user list, examines the .htaccess file and database for injected content and looks at the hosting account for signs of wider compromise. You should receive a plain-English summary of what was found, what is recommended and what it will involve before any chargeable work begins. That is how we approach it at WP Mate.

10

Hosting-level and DNS-level redirects

Not every redirect problem lives inside WordPress. If the domain’s DNS points to the wrong server, or a hosting-level rule redirects traffic, a perfectly clean WordPress install can still send visitors astray. Checking DNS records, the hosting panel’s redirect settings and any CDN rules is part of a thorough investigation. Equally, a compromised hosting account can inject redirects even when the WordPress files look clean. This is why a good assessment looks beyond the website folder to the surrounding accounts, credentials and settings, and why changing hosting and registrar passwords belongs on the recovery checklist.

11

Getting help

WP Mate preserves a backup of the affected state, assesses files and database, remediates with your authorisation and tests the website. Start with hacked website help or contact us.

Want this looked after for you?

WP Mate maintenance plans cover managed updates, daily offsite backups, security scanning and 24/7 uptime monitoring.

Think your website is hacked? Get a safe recovery plan.

How we can help

Services related to this guide

Hacked website help

Assess the damage and plan a safe recovery.Get Security Help →

WordPress repair

Broken website? We investigate the cause and fix it safely.Get a Repair Quote →

Talk to WP Mate

Not sure which service fits? Ask us and we will point you the right way.Contact us →

Frequently asked questions

Search engines may flag or demote compromised sites. Cleaning the infection and requesting a review is the usual path, though timing is controlled by Google.

Reinstalling core does not remove malicious code in plugins, themes, uploads or the database, so it is not a complete fix.

It is possible if the hosting account itself was compromised, which is why hosting access is reviewed too.

Ready to get your website sorted?

Based in Warrnambool, Victoria, helping Australian businesses online. Tell us what is happening.

Get WordPress help

Tell your mate what's going wrong.

Send us a few details and we’ll work out the next step. Please don’t include passwords or payment details.

  • Australian support in plain English
  • Clear scope and next steps before chargeable work
  • Backup and recovery plan before live changes

Please don't include passwords, payment card numbers or private customer data. If we need access, we'll arrange a secure way to share it.