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.
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.
Common causes
| Cause | Notes |
|---|---|
| Malicious code in files | Injected into theme, plugin or core files |
| Malicious code in the database | Injected scripts in posts, widgets or settings |
| A tampered .htaccess file | Redirect rules added at the server level |
| A compromised plugin or theme | Often nulled or outdated software |
| A redirect plugin or setting | Legitimate rules that are wrong or out of date |
| Changed site or home URL | WordPress settings pointing to another address |
| DNS or hosting changes | The 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.
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
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.
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.
Where the redirect code hides
| Location | Why attackers use it |
|---|---|
| Theme files such as header or functions | Runs on every page |
| Plugin files, including inactive plugins | Often forgotten and unmonitored |
| The .htaccess file | Acts before WordPress even loads |
| The database in posts or widgets | Survives a file clean-up |
| The uploads folder | Looks like harmless media |
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.
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.
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.
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.
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.
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
Will Google penalise my site for redirects?
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.
Can I just reinstall WordPress?
Reinstalling core does not remove malicious code in plugins, themes, uploads or the database, so it is not a complete fix.
Could my host be the cause?
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.
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
