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
Take a backup first
Copy your files and database as they are now, so nothing is lost and we can see what changed.
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.
Look at your users
In Users, filter by Administrator and look for accounts you don’t recognise.
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
# 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.