Is your redirected site sending visitors to spam or unknown pages? Here's how to triage it, find where the redirect hides, and clean it up for good.
You type in your own web address and land on a pharmacy ad, a fake prize page, or a site you've never heard of. Or a customer calls to say your link "goes somewhere weird." A redirected site is one of the most common signs of a hacked website, and it often shows up in a way that makes you doubt yourself, because it works fine for you and breaks for everyone else. This guide covers what to do in the first hour, where the redirect usually hides, and when to hand it off.
If you want the broader background on why sites send visitors elsewhere, see our explainer on redirected websites. This article is the hands-on triage version.
First, Work Out Which Kind of Redirect You Have
Not every redirect is an attack. A properly configured site redirects http to https, and often non-www to www. A plugin or an old migration can also leave harmless redirect rules behind. The redirects that matter are the ones you didn't set up and that send people to a different domain.
Malicious redirects are usually selective, because attackers don't want the owner to notice. Test the site in these ways before you change anything:
- Open it on your phone over mobile data, not your office wifi. Many redirects target mobile visitors only.
- Open it in a private window while logged out. Some scripts skip anyone logged in to WordPress.
- Search your business name on Google and click your own result. Some redirects only fire when the visitor arrives from a search engine.
- Try an inner page, not just the homepage. Injected code is sometimes limited to posts, product pages or the checkout.
- Ask a friend in another city or on another network to try it. Some scripts only fire once per visitor or by region.
If the redirect appears only for search visitors or only on mobile, treat that as strong evidence of compromise. Google calls this pattern a sneaky redirect: showing search engines one thing and sending users somewhere else. It is a violation of its spam policies, and it can get a site flagged or removed from results.
Where a Hacked Redirect Usually Hides
The redirect is rarely in one obvious place. Attackers plant several copies so that removing one doesn't solve the problem. These are the common locations on a WordPress site:
- The .htaccess file. A few added rewrite rules can send traffic anywhere. It's the first place people look, and attackers know it.
- Theme files. The functions.php or header.php file may contain obfuscated code, often a long string of random-looking characters.
- The database. Check the siteurl and home values in the options table, and look for script tags injected into posts, widgets or page-builder content.
- Plugins and mu-plugins. A fake plugin with a generic name, or a file in the must-use folder that doesn't appear in the normal plugin list.
- Core files and uploads. PHP files in the uploads folder have no good reason to exist.
- DNS or hosting level. If the redirect happens before WordPress loads, the problem may be in your domain settings or a compromised hosting account.
If you only fix the redirect you can see, the hacker's backup copy fixes it back.
What to Do in the First Hour
Speed matters, but so does order. Rushing to delete files can destroy evidence and leave the real backdoor in place. Work through this sequence:
- Take a full backup of the files and database as they are now, even though they're infected. You want a record to work from.
- Change passwords for hosting, WordPress admins, FTP/SFTP and the database. Do this from a clean computer.
- Review admin users and delete any you don't recognize.
- Update WordPress core, themes and plugins, and remove anything abandoned or unused.
- Compare your core files against a clean copy, and check .htaccess, functions.php and the uploads folder for code you didn't write.
- Search the database for injected scripts and check the siteurl and home settings.
- Request a review in Google Search Console if you've been flagged for security issues or hacked content.
The WordPress project's own hardening guide is a reasonable checklist for steps four onward, including file permissions and keeping software current.
Why Restoring a Backup Often Isn't Enough
Many owners restore last week's backup and think it's done. Sometimes that works. Often it doesn't, because the infection was already on the site when the backup was taken, or because the original entry point, such as an outdated plugin or a stolen password, is still open. A few days later the redirect returns, sometimes with a new destination.
A real cleanup finds the entry point, removes every backdoor, and then hardens the site so the same route is closed. We break down what that looks like in our guide to website malware cleanup in Toronto. If your redirect is tied to a bigger infection, the September 2026 website hacks recap shows which WordPress vulnerabilities are being exploited right now.
What a Redirect Costs You While You Wait
Every day the redirect stays live, visitors bounce, browsers or Google may show warning screens, and your email can be affected if your domain's reputation drops. Search rankings can slip too, which is why we cover the topic in why a hacked site undoes every ranking gain. Fixing it promptly protects your traffic as well as your site.
When to Call for Help
If you've found one suspicious file and don't know what else is there, or the redirect keeps coming back after you remove it, stop guessing. Our website malware removal service covers finding the infection, removing backdoors, and closing the hole that let it in. If you're comfortable in your files and database, the triage steps above will get you started.
The takeaway: a redirected site is almost never a single bad line of code. Check it from the visitor's side, back up before you change anything, and clean every location, not just the one that's showing.
References
- Google Search Central β Spam Policies for Google Web Search (Sneaky Redirects)
- WordPress Developer Resources β Hardening WordPress
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.



