Is your website redirecting to another site? Learn the 6 usual causes, how to test for hidden hack redirects, and when to call for malware removal.
If your website is redirecting to another site, you have one of two problems. Either someone set up a redirect on purpose and forgot, or someone else set it up without your permission. The fix is completely different for each, and guessing wrong can cost you weeks of lost traffic. This guide covers a faster path: a short triage to work out which problem you have, then the places a redirect usually hides.
Step 1: Work Out When the Redirect Happens
A harmless redirect, such as an old domain forwarding to a new one, fires every time for everyone. A malicious redirect is often selective. Attackers want the site to look normal to you, because the owner is the person most likely to fix it. So they hide it from anyone who looks like the owner.
Before you change anything, test the site in these ways:
- Open the site in a private window on your phone, using mobile data instead of your office Wi-Fi.
- Search for your business name on Google and click your own result. Do not type the URL directly.
- Visit an inner page, such as a blog post or product page, not only the homepage.
- Open the site while logged out of WordPress. Many injected scripts skip logged-in admins.
- Ask a friend or customer in another city to try it and tell you exactly where they land.
If the site behaves normally when you type the URL but sends people elsewhere when they arrive from Google, that is a strong sign of a hack. Legitimate redirects have no reason to care where the visitor came from.
Step 2: Rule Out the Boring Causes
Not every redirect is an attack. Check these first, because they take ten minutes:
- Registrar or host forwarding: a domain-forwarding setting at your registrar can override your site entirely.
- DNS records: an A record or CNAME pointing at the wrong server sends visitors to someone else's content.
- WordPress address settings: if the Site Address and WordPress Address under Settings > General don't match what you expect, the site bounces to the other address.
- HTTPS or www rules: a badly written rule can cause loops or send visitors to a different domain version.
- A redirect plugin: check for an SEO or redirect plugin with a forgotten rule, especially after a redesign or migration.
If none of these explain it, move on. For the full walkthrough on reversing a legitimate rule, see how to undo a website redirect.
Step 3: Look Where Hackers Hide Redirects
Attackers rarely put the redirect in one obvious place. They plant it in several, so that deleting one copy doesn't cure the site. The usual hiding spots are:
- The .htaccess file in your site root, often with rules that trigger only for search-engine referrers or mobile user agents.
- wp-config.php, index.php, and theme files such as header.php or functions.php, where a short block of obfuscated code can run on every page.
- The database: a script injected into post content, widgets, or the options table, so no file looks changed.
- Plugins you don't recognize, or files in the mu-plugins folder, which WordPress loads automatically and which don't show in the normal plugin list.
- Third-party scripts loaded from an outside domain, often through a tag or header-injection plugin.
If a redirect only shows up for visitors and never for you, treat it as a hack until you can prove otherwise.
Watch for lookalike filenames and recently modified files you didn't touch. Also check for new administrator accounts. A redirect that comes back after you remove it usually means a backdoor and a hidden admin user are still in place.
Why This Matters for Search Rankings
Google names this behaviour in its spam policies as "sneaky redirects": sending users somewhere different from what the search engine was shown. Even when you didn't do it, a hacked site that does this can be flagged, and your listing can pick up a warning or lose visibility. Speed matters. The longer the redirect runs, the more it can damage your listing. This is the same pattern we cover in small business SEO and hacked sites.
What to Do If It Is a Hack
Resist the urge to just delete the one suspicious line you found. A proper cleanup removes the redirect code, the backdoors that reinstall it, and the access the attacker used to get in. That includes updating or removing vulnerable plugins, resetting every password (WordPress, hosting, database, FTP/SFTP), and checking the site again from the outside. The WordPress hardening guide is a good baseline for what a locked-down site looks like.
If you'd rather not dig through files and database tables, our website malware removal service handles the whole job: finding every injected script, closing the way in, and checking that the redirect is gone for all visitors, not just you. For a picture of what a thorough job covers, read what a real malware cleanup involves. If you want more on the symptoms themselves, redirected websites is the companion read.
The Takeaway
A website redirecting to another site is a symptom, not a diagnosis. Test it from outside your own network, rule out the registrar, DNS, and plugin causes, and then assume a hack if the redirect is selective or keeps returning. Fix the cause, not just the symptom, and your visitors and your search listing will both recover faster.
References
- Google Search Central β Spam Policies for Google Web Search (Sneaky redirects)
- WordPress.org β Hardening WordPress (Advanced Administration Handbook)
This article is general educational information, not professional, medical, or purchasing advice. External links are provided for reference; DS Web Solutions Inc. is not affiliated with and does not endorse any third-party brand or organization listed.



