ClickCease WordPress Site Redirect Hack - How to Detect and Remove
WordPress Redirect Hack

If you notice that your website starts redirecting users to unknown websites, it was likely hacked. WordPressWordPressOpen-source content management system (CMS) that allows users to create and manage websites and blogs.
More About WordPress
site redirect hack
is one of the most exploited attacks among WP hackers. It has different variations and symptoms that we will discuss in this post. 

WordPress site redirect hack is not a new type of attack in the WP world. However, it has significantly evolved, making it hard or impossible for website owners to detect it without using some WordPress redirect hacks.

How to solve redirect hack? The best approach is to promptly clean up the redirect malware and take steps to safeguard your WordPress site from future infections. How to do it right? This guide explains how you can fix the WordPress redirect hack manually or using a pluginPluginA piece of software that can be easily installed and activated on a CMS platform to enhance its capabilities.
More About Plugin
and quickly eliminate the website’s malware infection so you can restore your site online professionally.

What is a WordPress  Redirect Hack?

WordPress Redirect Hack is a form of malware attack where malicious code is injected into a WordPress website, causing it to redirect visitors to other websites without their consent. This unauthorized redirection typically leads users to spammy or potentially harmful content, such as grey-market pharmaceutical products or illegal services.

WordPress hacked redirect infection occurs when various types of malware, such as faviconFaviconA small image that represents a website or a web page.
More About Favicon
malware, compromise the website’s files, folders, and databaseDatabaseAn organized collection of data, typically stored electronically.
More About Database
, enabling malicious redirectsRedirectsA way to send users and search engines from one URL to another.
More About Redirects
. This type of hack is widespread and can result in significant losses for website owners, including revenue, brand reputation, and search engine rankings.

One prominent example of a WordPress redirect hack is the pharma hack, which explicitly targets WordPress sites to promote pharmaceutical products through unauthorized redirects.

The consequences of a WordPress redirect hack can escalate rapidly as the malware spreads and infects more website components. Website owners must immediately address the hack and prevent further damage.

Seeking professional help to ensure utmost security for your website?

Symptoms of Redirect Hack

Detecting a redirect hack on your WordPress website can be challenging, as hackers often employ sophisticated techniques to conceal their activities. However, several telltale signs may indicate that your site has been compromised:

  • Sudden TrafficTrafficThe number of visitors or users who visit a particular website.
    More About Traffic
    . A noticeable decline in website traffic, especially if it occurs abruptly and without any apparent explanation, could be a sign of a redirect hack. Hackers may redirect your traffic to other websites, diverting visitors from your site.
  • Increased Bounce RateBounce RatePercent of users landing on a site & leaving without an action.
    More About Bounce Rate
    . A significant increase in your website’s bounce rate, mainly if it happens suddenly or is accompanied by a drop in engagement metrics, could indicate that visitors are being redirected elsewhere before engaging with your content.
  • Unexplained Website Behavior. Users may report unusual behavior when visiting your website, such as being redirected to unfamiliar or unrelated pages, experiencing unexpected pop-ups or advertisements, or encountering suspicious links.
  • Unwanted Pop-ups or Ads. If your website starts displaying unauthorized pop-ups, advertisements, or other intrusive content that you did not intend to include, it could be a sign of a redirect hack. Hackers may inject malicious code to trigger these unwanted elements.
  • Unusual Redirects. Different types of redirects, such as device redirects (redirecting mobile users to different pages), location redirects (redirecting users based on their geographic location), or push notification redirects (redirecting users via push notifications), may occur without your authorization.

It’s important to note that hackers are adept at covering their tracks and may use techniques such as cookiesCookiesSmall text files that websites store on your computer or mobile device when you visit them.
More About Cookies
or IP addressIP AddressInternet Protocol address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication.
More About IP Address
filtering to prevent website owners from detecting these symptoms. As a result, you may believe that everything is functioning normally when, in fact, your site has been compromised.

If you observe any of these symptoms or suspect that your website may have been hacked, it’s crucial to investigate further and take immediate action to secure your site and mitigate any potential damage.

How to Detect WordPress Redirect Spam?

Detecting WordPress redirect spam is crucial for maintaining the integrity and security of your website. Here are some methods users can employ to identify and detect such spam:

  • Use Security Plugins. Installing reputable security plugins can help automate the detection and prevention of WordPress redirect spam. These plugins often include malware scanning, firewallFirewallA network security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules.
    More About Firewall
    protection, and real-time monitoring for suspicious activities. Consider utilizing plugins like those listed in this guide to the best security plugins to enhance your website’s security posture.
  • Monitor Website Traffic. Use tools like Google AnalyticsGoogle AnalyticsA web analytics service that provides valuable insights into the performance and user behavior on websites and mobile applications.
    More About Google Analytics
    to monitor your website’s traffic patterns and metrics. Sudden spikes or drops in traffic, particularly if accompanied by unusual user behavior or high bounce rates, may indicate the presence of redirect spam.
  • Inspect Website Files. Inspecting your website’s files and directories can help uncover malicious code or unauthorized redirects. Look for suspicious scripts, unfamiliar files, or unexpected modifications in your WordPress installation, themes, and plugins.
  • Check .htaccess File. The .htaccess file in your WordPress root directory controls various aspects of your website’s configuration, including redirects. Review this file for suspicious directives or alterations indicating redirect spam.
  • Examine WordPress Core Files. Verify the integrity of your WordPress core files by comparing them against a clean installation. Any unauthorized modifications or additions may suggest that your website has been compromised.

Search Engine Warnings. Search engines like Google may flag websites that contain malicious content or engage in suspicious behavior, including unauthorized redirects. Monitor for any warnings or notifications from search engine console tools that indicate potential security issues.

How to Scan WordPress Site for Malicious Redirects 

To scan your website for malicious code, you need to identify how your website was infected and what kind of malicious redirects it faces. Once identified, proceed to the steps described below. They will help you identify malicious code and remove it from your site.

Using WordPress malware scanners may be the fastest and easiest way to scan, find, and remove malicious code from your WordPress site. Plugins like Astra should come in handy for this purpose. Astra’s free Security Scanner will notify you if your website has any malicious code snippets. If you look forward to identifying and removing redirection hacks manually, the following hacks should come in handy for you. 

Running a file integrity check using WP-CLI, you can see if any malicious code has been added to your site’s core files. To verify WP core file integrity, take the following steps: 

  1. Login to your server via SSH.
  2. Install WP-CLI.
  3. Change directory to the location of your WP site
    cd /var/www/htmlHTMLThe fundamental language used to create and structure content on web pages.
    More About HTML
  4. Use the “wp core version” command to check your current WordPress version.
  5. Use the “wp core verify-checksums” command to get a list of files, which checksum doesn’t match the original WordPress release. Check the output of the command. If you find some warnings, it’s okay. If core files do not match checksums, you will need to replace your core files or restore a backup.

Using the Astra plugin, you can visually check the difference between the original CMSCMSA content management system is software aiding users to create, manage, and modify website content.
More About CMS
file and the actual file.

Hackers usually leave backdoors to get back to your WordPress site. These are commonly named legitimate files, which you can detect while running a manual search within your site’s file. You can search for such malicious PHPPHPHypertext Preprocessor is a programming language primarily used for web development.
More About PHP
functions as eval, base64_decode, gzinflate, preg_replace, str_rot13, eval, etc. WordPress plugins use all these functions for legitimate reasons. Check twice before removing any of them so that you do not break your site accidentally. 

Login to your WordPress site’s admin area and check if any unknown administrators have been added. Hackers can add themselves as admins to your site to get access to your WordPress admin area and reinfect it after removing the redirection hack. If you find any such users, remove them immediately and change login credentials for all users who are allowed to access your site’s admin area. 

Check plugins and themes for vulnerabilities. Check the list of WordPress plugins installed on your site. If you notice any solutions that you have never added to your site, delete them straight away. For plugins that have updates available for installation, check if any security issues have been found recently. Check plugin files for backdoors and redirections, as we have previously discussed. 

You can also use tools like diff checker to compare your plugin files with their original versions. To compare, download the plugins installed on your website from the WordPress directory and match them against the solutions used on your site. 

Last but not least useful solution is to search databases for malicious links. For this, log in to phpMyAdmin or Adminer and search for such terms as <script>, eval, base64_decode, gzinflate, preg_replace, str_replace, etc. Be very attentive and careful when you decide to bring any changes to the code because a simple typo or an extra space can break your site from loading the function properly. 

How to Fix WordPress Redirect Hack

Dealing with WordPress redirect spam is crucial for maintaining the security and reputation of your website. Fortunately, there are three primary approaches to fixing this issue:

  • Using Plugins. Plugins offer a convenient and relatively straightforward solution to clean up WordPress redirect spam. They automate the scanning and removal process, making it accessible to users without extensive technical knowledge. However, not all plugins can effectively clean all types of malware code, and complex infections may require professional intervention. Recommended plugins include Sucuri Security, Wordfence Security, and MalCare.
  • Manual Cleanup. Manual cleanup provides a more hands-on approach for users comfortable with coding and website management. This method involves identifying and removing malicious code from website files, databases, and configuration files. While effective, manual cleanup can be time-consuming, complex, and prone to errors if not performed correctly.
  • Hiring a Professional. Engaging the services of a professional WordPress maintenance and security provider offers a high-quality, efficient solution to fix redirect spam. Experienced professionals possess the expertise and tools to thoroughly clean and secure your website, protecting it against future attacks. If you prefer to entrust the cleanup process to experts, consider utilizing services like those offered by WordPress maintenance service.

How to Fix Manually

While manually fixing WordPress redirect spam can be challenging and time-consuming, some users may prefer to tackle it themselves. Here’s a general guide on manually cleaning up redirect spam from your WordPress website:

  • Identify Suspicious Code. Examine your website’s files, including theme files, plugin files, and WordPress core files. Look for any unfamiliar or suspicious code, such as unauthorized redirects, hidden iframes, or malicious scripts.
  • Check .htaccess File. Review the .htaccess file in your WordPress root directory for any unauthorized redirects or modifications. Remove any suspicious directives or code that you did not add yourself.
  • Inspect Theme and Plugin Files. Examine the files of your active theme and installed plugins for any signs of malware or malicious code injections. Look for unusual code snippets, unfamiliar files, or unexpected modifications.
  • Search Database for Malicious Code. Access your WordPress database using tools like phpMyAdmin or similar database management tools. Search for any instances of suspicious code, such as base64-encoded strings or unfamiliar database entries.
  • Remove Malicious Code. After identifying the malicious code, carefully remove it from your website files and database. Be cautious not to inadvertently delete essential code or files for your website’s functionality.
  • Secure Your Website. After cleaning up the malicious code, enhance your website’s security to prevent future attacks. Update all themes, plugins, and WordPress core files to their latest versions, strengthen password security, and consider implementing security measures like firewall protection and regular malware scans.

While the provided steps offer a general outline for manual cleanup, it’s essential to note that WordPress redirect spam can manifest in various forms, and the specific cleanup process may vary depending on the nature of the infection. Users may need to refer to the official documentationDocumentationThe process of creating, organizing, and maintaining written materials that provide information about a web project.
More About Documentation
of WordPress files to understand their purpose and identify any anomalies. Explore the WordPress Files documentation for more information.

1. Backup your website

Backing up your website is crucial before making any changes, especially when dealing with potential hacks. It ensures you have a copy of your site’s files and database if anything goes wrong during the cleanup process. This step is essential for restoring your website to its previous state.

2. Download plugins and themes

Downloading clean copies of your plugins and themes allows you to compare their code with the versions currently installed on your website. Ensure you download the same version to identify any discrepancies accurately. Remember that the user’s custom settings or modifications may differ between the downloaded files and those on your site.

3. Check .htaccess file

Inspect the .htaccess file in your website’s root directory for suspicious or unauthorized directives. Hackers often manipulate this file to implement mobile redirects or other malicious actions. If you find anything unusual, such as unfamiliar, rewrite rules, remove or modify them accordingly.

4. Check .php files

Examine key PHP files, including wp-config.php, index.php, settings.php, and load.php, for any malicious code or unauthorized modifications. Look for unfamiliar code snippets or functions that do not belong. Remove or replace the affected code with clean versions if you detect any anomalies.

5. Check the folders 

Inspect critical folders like wp-admin and wp-includes for any suspicious files or directories. Pay attention to files that do not belong or have been recently modified. If you identify any unauthorized files or changes, delete or restore them to their original state.

6. WordPress Theme

Review active theme files, such as headerHeaderA visual and typographical band or menu commonly situated at the uppermost part of a website’s interface.
More About Header
.php, footerFooterA section at the bottom of a webpage with contact details, copyright notices, and links to important pagesOne of the primary functions of a footer is to provide navigation.
More About Footer
.php, and functions.php, for any malicious code or unauthorized changes. Look for unfamiliar scripts or functions that may indicate a hack. Remove any suspicious code and ensure the integrity of your theme files.

7. WordPress Plugins

Evaluate installed plugins for signs of compromise by checking their files and configurations. Look for unfamiliar code or unexpected modifications that could indicate a hack. Disable or remove any suspicious plugins and replace them with clean versions if necessary.

8. Database Cleanup

Inspect your WordPress database for any suspicious entries or unauthorized changes. Look for unfamiliar users, tables, or data that may indicate a security breach. Remove or restore any compromised database elements to ensure the integrity of your site’s data.

9. Remove Backdoors 

Backdoors are hidden entry points that hackers use to regain access to a compromised website. Search for any backdoors in your website files, such as disguised PHP scripts or unauthorized user accounts. Remove these backdoors to prevent further unauthorized access.

10. Credentials Update

Review user accounts for any unfamiliar or unauthorized users and delete them immediately. Update your administrative credentials with a strong, unique password, and consider implementing two-factor authentication for added security.

11. Clean Cache

Cleaning the cacheCacheA temporary storage location that stores frequently accessed data to reduce load times.
More About Cache
ensures visitors receive your website’s most recent version and helps remove any cached malicious content. This step helps prevent visitors from being exposed to harmful redirects or spammy content.

12. Apply All Changes at Google Search Console

Inform Google about the changes you’ve made to your website by updating your Google Search Console profile. This ensures that Google indexes the clean version of your site and removes any penalties or warnings associated with the hack. Failure to do so may result in continued issues with your website’s search engine visibility.

How Websites Get Hacked

website hacked redirect

WordPress websites can fall victim to hacking through various vulnerabilities and exploitation methods. Some common ways hackers may compromise a website include:

  • Weak Passwords. One of the most straightforward methods for hackers to gain access to a website is through weak or easily guessable passwords. If website owners use simple or commonly used passwords, it becomes relatively simple for hackers to brute force their way into the site.
  • Outdated Software. Hackers often exploit vulnerabilities in outdated software, including content management systems (CMS) like WordPress, plugins, themes, and server software. Failure to regularly update these components leaves websites susceptible to known security flaws that hackers can exploit.
  • SQLSQLStructured Query Language is a programming language used to manage and manipulate relational databases.
    More About SQL
    Injection (SQLi)
    . SQL injection attacks occur when hackers exploit a website’s input field vulnerabilities to inject malicious SQL code. This can allow attackers to access or manipulate a website’s database, potentially gaining unauthorized access to sensitive information or executing harmful actions.
  • Cross-Site ScriptingScriptingThe process of creating a series of commands or instructions that are executed by a computer or software application.
    More About Scripting
    . Cross-site scripting attacks involve injecting malicious scripts into web pagesWeb PagesHTML documents accessed via the internet.
    More About Web Pages
    viewed by other users. Hackers exploit vulnerabilities in web applications to execute scripts in the context of an unsuspecting user’s browserBrowserA software application that enables you to view and interact with websites.
    More About Browser
    , enabling them to steal cookies, session tokens, or other sensitive information.
  • File Upload Vulnerabilities. Websites that allow users to upload files without proper validation or security measures are susceptible to file upload vulnerabilities. Hackers may upload malicious files, such as scripts or malware, which can then be executed on the server, leading to unauthorized access or further compromise.
  • Brute Force Attacks. In a brute force attack, hackers use automated tools to systematically guess usernames and passwords until they find the correct combination to gain access to a website. This method is particularly effective against weak or poorly protected login credentials.
  • Phishing. Phishing attacks involve tricking website administrators or users into disclosing sensitive information, such as login credentials or financial data, through fraudulent emails or websites. Once obtained, this information can be used to gain unauthorized access to the website or carry out other malicious activities.

How Redirect Hack Affects Websites

Redirect hacks can significantly negatively impact websites, affecting their functionality, user experience, and reputation. Here are some ways redirect hacks can affect a website:

  • Loss of Trust. When visitors encounter unauthorized redirects on a website, they may lose trust in its integrity and reliability. Being redirected to spammy or malicious websites can make users perceive the affected site as untrustworthy, potentially damaging its reputation.
  • Poor User Experience. Redirect hacks disrupt the normal browsing experience by diverting users from the intended content. Users may become frustrated or confused when they are unexpectedly redirected to unrelated or irrelevant web pages, leading to increased bounce rates and decreased engagement.
  • Damage to SEOSEOSearch Engine Optimization involves optimizing various website elements to make it more attractive to search engines like Google, Bing, and Yahoo.
    More About SEO
    . Search engines like Google prioritize user experience and may penalize websites that use deceptive or manipulative practices, such as unauthorized redirects. Websites affected by redirect hacks may experience a decline in search engine rankings, reducing their visibility and organic traffic.
  • Blacklisting. Suppose a website is found to be engaging in malicious activities, such as redirecting users to phishing sites or distributing malware. In that case, it may be flagged by security authorities and added to blacklists. Being blacklisted can result in warnings being displayed to visitors, further eroding trust and deterring users from accessing the site.
  • Financial Loss. Redirect hacks can have financial implications for website owners, mainly if they rely on advertising revenue or e-commerce transactions. Reduced traffic and diminished user trust can lead to decreased ad revenue or sales, resulting in financial losses for the business.
  • Reputation Damage. A website that has been hacked and used to carry out redirect spam can suffer significant damage to its reputation. Users may associate the site with spammy or malicious content, resulting in long-term reputational harm that can be difficult to repair.

Redirect hacks severely threaten websites, impacting their credibility, usabilityUsabilityThe measure of a product’s effectiveness, efficiency, and satisfaction for its intended users.
More About Usability
, and search engine visibility. Website owners need to take prompt action to detect and address redirect hacks to mitigate these negative consequences and safeguard their online presence.

How to Prevent Redirect Hack

fix wordpress redirect hack

Preventing redirect hacks requires implementing robust security measures and staying vigilant against potential vulnerabilities. Here are some effective strategies to prevent redirect hacks:

  • Keep Software Updated. Regularly update your website’s content management system (CMS), plugins, themes, and server software to patch known security vulnerabilities. Hackers often exploit outdated software to gain unauthorized access to websites.
  • Use Strong Passwords. Enforce strong password policies for all user accounts, including administrators, editors, and contributors. Use complex passwords that include a combination of letters, numbers, and special characters, and consider implementing multi-factor authentication (MFA) for added security.
  • Implement Website Firewall. Install a web applicationApplicationA software program designed to perform specific functions or tasks on electronic devices, such as smartphones and tablets, computers, and smart TVs.
    More About Application
    firewall (WAF) to monitor and filter incoming traffic to your website. A WAF can detect and block malicious requests, including those associated with redirect hacks, before they reach your site.
  • Employ Security Plugins. Utilize reputable security plugins for your CMS, such as Wordfence Security, Sucuri Security, or MalCare. These plugins offer features like malware scanning, file integrity monitoring, and firewall protection to safeguard your website against hacks and intrusions.
  • Restrict File Uploads. Limit file upload capabilities on your website to prevent hackers from uploading malicious files, such as scripts or malware. Implement strict file validation and filtering measures to accept only authorized file types.
  • Regular Security Audits. Conduct periodic security audits of your website to identify and address potential vulnerabilities. Scan your website for malware, suspicious files, and unauthorized modifications, and take prompt action to rectify any issues.
  • Secure .htaccess File. Protect your website’s .htaccess file by restricting access permissions and regularly monitoring for unauthorized changes. Hackers often manipulate the .htaccess file to implement redirects, so securing it is crucial for preventing redirect hacks.


Protecting your website from redirect hacks and other malicious attacks is crucial for maintaining its integrity, reputation, and functionality. While implementing preventive measures such as updating software, using strong passwords, and employing security plugins can significantly reduce the risk of hacks, there is no foolproof guarantee of security.

To ensure comprehensive protection and achieve peace of mind, it’s highly recommended to consider hiring professionals who specialize in website security. The IT Monks team possesses the knowledge, experience, and tools to thoroughly assess your website’s security posture, identify vulnerabilities, and implement robust security measures. Whether you need to launch a secure website from scratch or ensure your current project is safe and secure, contact our expert team for help.

WordPress Site Redirect Hack FAQ

What is a classic WordPress redirect hack? 

There are many types of WordPress site redirect hacks. Classic WordPress redirect hack is the most common one. It redirects users who click on links on an attacked website to questionable URLs of pharma websites, which commonly include adult content.

What are the symptoms of a WordPress site redirect hack?

There are several major symptoms of WordPress site redirect hacks that website owners should know about:

  • Suspicious shortened links leading to unwanted redirects
  • Unexpected redirects to spam pages or websites
  • Strange push notifications on your webpages
  • Unusual verification notifications or CAPTCHACAPTCHACompletely Automated Public Turing test to tell Computers and Humans Apart is a security measure designed to differentiate between humans and automated bots on the internet.
    More About CAPTCHA
  • Unexpected new code in your .htaccess files
  • Unfamiliar JavaScriptJavascriptA high-level, dynamic, and interpreted programming language primarily used to create interactive and responsive user interfaces on web pages.
    More About Javascript
    in your index.php file
  • Spam in your site’s Google search results
How to fix the WordPress site redirect hack? 

These are the must-follow steps on how to fix the WordPress site redirect hack, which should  work on most of the infected websites:

  • Check backdoors in webroot and uploads;
  • Look for modified index.php files and malicious include in wp-blog-header.php;
  • Scan for appended obfuscated JavaScript;
  • Check for database injections;
  • Remove backdoorBackdoorA hidden method or access point that allows unauthorized users to gain entry into a system or application.
    More About Backdoor
  • Remove bogus admin users.
Let’s discuss your project
Get quote
More Articles by Topic
WordPress powers over 455 million websites worldwide. When it comes to ecommerce, many potential site owners wonder, “Is WordPress secure…
There are many content management systems available. However, not all of them let you create a fully functional ecommerce website.…
An ecommerce website launch is a logical step most businesses take after creating a stunning product or service. However, after…


Feel free to reach out! We are excited to begin our collaboration!
Alex Osmichenko
Business Consultant
Reviewed on Clutch

Send a Project Brief

Fill out and send a form. Our Advisor Team will contact you promptly!

    Note: We will not spam you and your contact information will not be shared.