How to Stop WordPress Redirecting to Spam Websites (Quick Fix)
Think about this: You’re attempting to verify your WordPress web site when, all of the sudden, you’re taken away to a suspicious playing web site or a sketchy pharmaceutical web page.
Your coronary heart sinks as you notice your web site’s been hacked. 😱
We all know precisely how terrifying and irritating this example will be. However first, take a deep breath.
Your web site will be saved, and we’re right here to information you thru each step of the restoration course of. Whether or not your guests are seeing spam redirects otherwise you’re getting that dreaded “This web site could also be hacked” warning from Google, we’ve bought you lined.
On this article, we’ll present you two confirmed methods to cease WordPress redirecting to spam web sites.

Why Is My WordPress Web site Redirecting to Spam?
Spam redirects occur when hackers inject malicious code into your WordPress web site. This code then sends guests to undesirable web sites crammed with adverts, phishing scams, or malware.
Hackers can use completely different strategies to realize entry to your web site, together with:
- Contaminated Plugins & Themes: Plugins and themes downloaded from unauthorized sources (nulled WordPress themes and plugins) are a typical explanation for malware and spam redirects.
- Weak Passwords: Attackers can guess or steal weak admin passwords to take management of your web site and insert malicious code that redirects customers to spam websites.
- Unpatched Safety Holes: In case your WordPress core, plugins, or themes are outdated, then hackers can exploit recognized vulnerabilities so as to add malicious code.
- Hidden Backdoors: Even after eradicating seen malware, hackers typically depart hidden entry factors to reinfect your web site later. These are known as backdoors.
Many web site homeowners don’t notice their site has been hacked till guests begin complaining or search engines like google and yahoo difficulty a warning. The earlier you act, the much less injury it is going to trigger.
We’ll cowl 2 strategies on this article, and be at liberty to make use of the soar hyperlinks under to go to the strategy you need to use:
Let’s start with our really useful answer as a result of it’s simpler for rookies, non-tech customers, and small enterprise homeowners.
Methodology 1: Use A Hacked Web site Restore Service (Beneficial 🎯)
When your web site’s been compromised, time is of the essence. Each minute your web site redirects to spam web sites may imply misplaced guests, broken repute, and potential Google penalties.
That’s why many web site homeowners select knowledgeable restore service – it’s the quickest, most secure method to get again on-line.
The Professional Resolution:
For many WordPress customers, the best method to clear spam redirects is through the use of our skilled Hacked Site Repair Service.

For a one-time (non-recurring) payment, our group of WordPress security experts will clear your web site and take away the malicious code redirecting to spam websites.
Our Hacked Web site Restore Service gives a number of key advantages:
- Professional technicians who’ve dealt with 1000’s of hacked websites
- Emergency response & well timed fixes
- Full malware removing and safety hardening
- Put up-cleanup backup of your web site
- No threat of by accident damaging your web site
One of the best half is that you just get a 30-day assure and a full refund if we’re unable to repair your WordPress web site.
👉 Prepared for skilled assist? Simply go to our Hacked Site Repair Service web page to get began.
Methodology 2: Repair WordPress Spam Web site Redirects Manually (DIY Customers)
Should you’re snug with WordPress and like to deal with issues your self, then we’ve created a complete step-by-step information.
We’ll stroll you thru every a part of the cleanup course of, explaining what to do and why it issues.
⚠️ Warning: Whereas DIY fixes are potential, they are often dangerous in the event you’re not acquainted with WordPress security. One mistaken transfer may make the issue worse or result in information loss.
ℹ️ Essential: Create a Backup Restore Level
Earlier than beginning any repairs, be sure you have a current backup of your web site. If one thing goes mistaken, then you definitely’ll desire a restoration level.
We suggest utilizing Duplicator, which simply backs up and restores your web site. We use it throughout our enterprise, and it has been a game-changer for our safe backup wants. For extra particulars, take a look at our full Duplicator review.

Word: A free version of Duplicator can also be out there. You can provide it a attempt, however we suggest upgrading to a paid plan, which gives extra options.
Now that you’ve ready your web site for repairs, let’s begin fixing spam redirects.
Step 1: Scan Your Web site for Malware
Consider malware scanning like utilizing a metallic detector on the seaside – it helps you discover hidden threats buried in your web site’s information.
Our expertise exhibits that spam redirects typically cover in sudden locations, making a radical scan important.
Fortunately, there are wonderful WordPress security plugins out there that you need to use to scan your web site.
Right here’s how one can run an efficient malware scan.
First, it is advisable set up a trusted safety plugin (like Sucuri Security or Wordfence). For the sake of this text, we are going to present you how one can run a scan in Wordfence, however the directions work the identical no matter which safety plugin you’re utilizing.
First, you will have to put in the safety plugin of your alternative. For particulars, see our information on how to install a WordPress plugin.

Subsequent, beneath the plugin menu, navigate to the Scan part and run a comprehensive site scan. It may possibly take a while to finish the scan relying on how a lot information and information you have got saved.
As soon as that’s completed, you will notice the scan outcomes.
Assessment the outcomes rigorously and search for extreme, important, and different points. You possibly can click on on a difficulty to view its particulars.
Right here, most safety plugins may also offer you directions on how one can deal with that difficulty.

WordPress security scanners are fairly good at catching a few of the most infamous malware and redirect hacks. Hopefully, they are going to be capable to discover the code answerable for spam redirects.
💡 Professional tip: Don’t depend on only one scanner. Totally different safety instruments can catch various kinds of malware. We suggest utilizing no less than two completely different scanning options.
Step 2: Verify for Suspicious Admin Customers
Hackers typically create hidden administrator accounts to keep up entry to your web site. These accounts may need innocent-looking usernames or be disguised as system accounts.
We’ve seen circumstances the place hackers created a single cleverly disguised admin person account. We’ve additionally seen circumstances the place the malware created dozens of admin accounts.
Simply observe these steps to determine and take away suspicious customers.
Go to the Customers » All Customers web page in your WordPress admin dashboard.

Right here, it is advisable search for accounts you don’t acknowledge. These could possibly be accounts with random numbers or unusual usernames or accounts pretending to be system accounts.
Subsequent, it’s time to remove any suspicious accounts instantly by clicking ‘Delete’ beneath that account.

⚠️ Warning: Some hackers title their accounts after widespread WordPress roles like “admin_support” or “wp_maintenance”. Be additional vigilant with system-looking usernames.
Upon getting reviewed and deleted suspicious person accounts, you possibly can transfer on to the following step.
Step 3: Exchange Hacked WordPress Recordsdata
Similar to changing a virus-infected laborious drive with a clear one, we have to restore clear variations of core WordPress information.
Don’t fear – this gained’t have an effect on any of your web site content material, photos, themes, or plugins.
Right here’s our examined course of for secure file alternative.
First, it is advisable obtain a contemporary copy of WordPress from WordPress.org and unzip the file in your pc.

Subsequent, hook up with your web site utilizing an FTP client or File Supervisor app in cPanel and navigate to the WordPress root folder.
That is the folder the place it is possible for you to to see the wp-admin
, wp-includes
, and wp-content
folders.

Now, go forward and delete the prevailing wp-admin
and wp-includes
folders.
As soon as they’re deleted, it is advisable add the clear variations out of your pc.

After changing the primary folders, it is advisable exchange all core information within the root listing. This contains information like wp-activate.php
, wp-blog-header.php
, wp-comments-post.php
, wp-config-sample.php
, and extra.
When prompted, choose ‘Overwrite’ to exchange outdated information with the brand new model.
Subsequent, it is advisable obtain the wp-config.php
file to your pc as a backup and delete the .htaccess file
out of your root folder. Don’t fear as a result of WordPress will robotically regenerate the .htaccess
file for you.

Now, it’s important to rename the wp-config-sample.php
file to wp-config.php
after which right-click to ‘Edit’ it. The file will open in a text editor like Notepad or TextEdit.
Rigorously fill within the values for the database connection. You possibly can see the outdated wp-config.php
file that you just downloaded within the earlier step to seek out out your WordPress database, desk prefix, username, password, and hostname.
For extra particulars, see our information on editing the wp-config.php
file.
Upon getting completed changing the outdated core information with contemporary copies, don’t overlook to go to your web site and admin dashboard to ensure every little thing is working as anticipated.
After that, you possibly can transfer on to the following step.
Step 4: Take away Malicious Code from Theme & Plugin Recordsdata
One of many widespread sources of malware is nulled plugins and themes. These are pirated copies of premium WordPress plugins and themes downloaded from unauthorized sources.
Hackers love hiding malicious code in theme and plugin information. They typically inject their spam links and redirects into reliable information, making them more durable to identify. However don’t fear – we’ll present you precisely what to search for.
⚠️Warning: Most WordPress theme and plugin settings are saved within the database and can stay there even in the event you delete these information. Nonetheless, typically, it’s possible you’ll lose settings or customized adjustments you made to these information. In that case, you will have to manually restore these adjustments.
Simply observe this course of to wash your plugin and theme information.
First, it is advisable obtain contemporary copies of all of your themes and plugins from reliable sources. Totally free themes and plugins, the trusted supply is the WordPress.org web site itself. For premium themes and plugins, it would be best to obtain them from official web sites.
Upon getting downloaded all of the plugins and theme information, hook up with your web site using an FTP client and navigate to the wp-content
folder.
Now, it is advisable delete the themes
and plugins
folders out of your web site. As soon as they’re deleted, create new directories and title them ‘themes’ and ‘plugins’. You’ll now have empty themes
and plugins
folders in your web site.

Now you can begin importing the theme and plugin information you downloaded earlier. You have to to unzip every downloaded file earlier than you possibly can add them to your web site.
Upon getting uploaded all of the information, go to your WordPress admin space within the browser and activate the theme and plugins you have been utilizing earlier than. Should you see an error, then it’s possible you’ll must attempt importing that exact theme or plugin file once more.
Changing theme and plugin information with newer variations downloaded from genuine sources will clear them.
Hopefully, by now, your web site might be clear of any spam redirects. Nonetheless, to make sure your web site stays safe, you will have to tighten its safety.
Step 6: Securing WordPress After Cleansing Up Spam Redirects
Safety shouldn’t be a one-time factor. As an alternative, it’s an ongoing course of.
Now that you’ve cleaned and stuck the spam redirects, the following step is to make sure your web site stays clear going ahead.
To try this, it is advisable carry out some further safety hardening in your web site.
1. Change All Web site Passwords
Passwords play an necessary function in WordPress safety. Should you imagine your web site was hacked, then it is advisable instantly change all your passwords associated to your web site.
This contains the next:
- All person accounts in your WordPress web site. See our information on changing passwords for all users in WordPress.
- Passwords for all FTP accounts in your web site. You will discover FTP accounts in your WordPress internet hosting management panel, and you’ll handle their passwords there.
- Passwords in your WordPress database username. You will discover MySQL customers in your internet hosting account management panel beneath the Database part. It’s essential to replace the password for the database username in your
wp-config.php
file as properly. In any other case, your web site will begin exhibiting the error connecting to the database error.
💡Professional Tip: At all times use stronger passwords and a password supervisor app like 1Password to retailer all of your passwords.
2. Set up a Safety Plugin and a WordPress Firewall
Now that we’ve cleaned up the hack, it’s time to strengthen your web site towards future assaults. Consider this step as putting in a high-tech safety system in your WordPress web site.
Right here’s our really useful safety setup:
- Set up a WordPress safety plugin like Sucuri or Wordfence (each have wonderful free variations).
- Arrange a WordPress firewall that runs on the cloud. We suggest utilizing the Cloudflare free CDN, which robotically blocks any suspicious exercise even earlier than it reaches your web site.
We use Cloudflare on WPBeginner. You possibly can examine our expertise in our case study on switching to Cloudflare.
The mix of a WordPress safety plugin that runs in your web site and a cloud-based firewall strengthens your WordPress safety to knowledgeable degree. It’s able to blocking the commonest malware, DDoS assaults, and brute force hacking attempts.
Bonus Ideas: Stop Future WordPress Hacks
The easiest way to cope with hacks is to forestall them from taking place within the first place. After serving to numerous customers get well their websites, we’ve developed a stable prevention technique.
You possibly can learn all of them in our complete WordPress security handbook. It’s a step-by-step safety setup we use on all our web sites, written particularly for rookies and small companies.
Listed below are our prime safety practices:
The following pointers are fast and straightforward to implement. They’ll defend you from malicious spam URL redirect assaults sooner or later.
Remaining Phrases: Securing WordPress From Spam Redirects and Malware
Coping with spam redirects will be scary, however you’ve now bought all of the instruments and information wanted to repair your web site.
Whether or not you select our Hacked Site Repair service (Recommended) or observe the DIY information, you’re taking the proper steps to safe your WordPress web site.
Bear in mind, safety isn’t a one-time repair – it’s an ongoing course of. Through the use of the prevention ideas we’ve shared, you’ll be a lot better protected towards future assaults. 💪
You might also want to learn our article on how to tell if a WordPress security email is real or fake or how to secure WordPress multisite.
Should you favored this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You may as well discover us on Twitter and Facebook.