Seeing · Symptom guide

Why does my WordPress site redirect to spam sites?

If visitors are being sent to pages you didn’t choose, most often spam, pharmacy or casino sites, something on your site is changing where it sends people. Here’s how to check, what it usually is and what to do next.

Hacked right now? Call us 0191 580 4040 Mon-Fri, 9am-5:30pm
Not urgent? Contact us

What this usually means

Redirects to unfamiliar sites usually come from injected code. It can sit in a theme file, a plugin, the database or your .htaccess file. The redirect is often conditional, which is why site owners can miss it for days.

  • Code added to .htaccess or index.php
  • A compromised or out-of-date plugin or theme
  • Malicious JavaScript stored in the database
  • An unrecognised administrator account that made the changes

How to check, step by step

  1. Take a backup first

    Copy your files and database as they are now, so nothing is lost and we can see what changed.

  2. Check your .htaccess file

    Open it in your file manager or over SFTP and compare it with the standard WordPress rules below. Anything extra deserves a closer look.

  3. Look at your users

    In Users, filter by Administrator and look for accounts you don’t recognise.

  4. Review recent changes

    Sort plugins and themes by update date, and look for files modified recently that you didn’t touch.

The standard WordPress .htaccess

.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

When to get help

If you’ve found something, or you’ve checked and still aren’t sure, it’s worth asking someone to take a look. We can check your files and database, remove the code and close the way in.

Send us the details

Frequently asked questions

Will Google penalise my site for redirecting visitors?

Search engines can flag or demote sites that send people to spam. Once the site is clean, you can ask Google to review it in Search Console, and we can help with that.

Why can’t I see the redirect myself?

Many redirects only trigger for visitors from search engines, on mobile devices, or who aren’t logged in. Testing in a private window on your phone is the quickest way to see what visitors see.

Can I just restore a backup?

Sometimes, if the backup is from before the problem and you also close the way in. Restoring without fixing the cause often means it comes back.

Call us Get in touch