My website is redirecting to another website. How can I fix it?

Dibbyyan Nath
12 Min Read

Dealing with those unexpected website redirections can be a real headache, right? It’s like being caught in a maze without a map. But fear not, in this article, I’ve covered most of the aspects to help you figure out why those pesky redirects are happening and how to fix them.

What does hacked redirect mean for WordPress?

Hacked redirect” for WordPress typically refers to a form of cyber-attack where the attacker modifies your WordPress website, causing it to automatically redirect visitors to other, often malicious or scam websites. This malicious behaviour can be due to a number of reasons, such as exploiting vulnerabilities in WordPress plugins, themes, or the WordPress core itself. Furthermore, The attacker usually injects malicious JavaScript code into various files of the compromised WordPress website, including legitimate WordPress core files.

Website redirect

When your WordPress site is affected by a hacked redirect, visitors to your site might be taken to scam pages, phishing pages, malware-laden sites, or sites serving unwanted ads. In some cases, visitors might even be taken to a rogue redirect landing page with a fake CAPTCHA check, which, when clicked, displays deceptive ads appearing as if they originate from the operating system.

You know what! the consequences of a hacked redirect are severe and can include SEO ranking decline, domain blacklisting, loss of website traffic, decreased revenue, harm to your brand’s reputation, slow loading speed, and even data breaches.

How do I know if my WordPress site redirects to Spam?

Here are some signs to check if your WordPress site is redirecting to spam:

Spammer stealing information from Hacked WordPress website
  1. Unsolicited website redirections: Your website automatically redirects users to other sites, usually spam or malicious sites.
  2. Mobile-only redirects: Some malware only targets mobile users. If your site is redirecting only on mobile devices, this could be a sign of a redirect hack.
  3. Google warnings: If Google is flagging your site as spam or issuing warnings about your site, this could indicate a redirect hack.
  4. Web host suspensions: If your hosting provider suspends your website, this could be due to spam redirection or other malicious activity detected on your site.
  5. Unidentified push notifications: You may notice push notifications from unidentified sources. This could be a sign of a redirect hack.
  6. Malicious code in installation files: Presence of junk code or unfamiliar code in your installation files could be a sign of malware. You may find this code in core WordPress files, theme files, plugin files, or in your database.
  7. Suspicious files on the web server: The presence of strange files on your web server that you don’t recognize could be a sign of a hacked site.

How can I prevent my browser from redirecting to another website?

To prevent your browser from redirecting to another website, you can follow these general guidelines based on the browser you’re using:

Hacked Website

For Google Chrome:

Chrome Pop-Ups and Redirects Settings
  1. Open Chrome and click on the three dots icon in the upper right corner.
  2. Select Settings, scroll down, and click on Advanced.
  3. In the Privacy and security section, choose Site Settings > Pop-ups and redirects.
  4. Ensure that the description reads Blocked (recommended).

For Microsoft Edge:

Microsoft Edge Security Mode
  1. Open Edge and click on the three dots icon in the top right corner.
  2. Select Settings > Enhance your security on the web.
  3. Enable enhanced security mode> Strict.

For Mozilla Firefox:

  1. Open Firefox and click on the three lines icon in the top right corner.
  2. Select Options, go to the Privacy & Security section.
  3. Enable Block pop-up windows and Block dangerous and deceptive content.

For Opera:

  1. Open Opera and click on the Menu option in the top left corner.
  2. Select Settings, scroll down, and click Advanced.
  3. In the Privacy & security section, choose Content settings > Pop-ups and redirects.
  4. Ensure that the Allowed option is turned off.

For Safari:

  1. Open Safari, go to Preferences > Security.
  2. Tick the option Warn when visiting a fraudulent website.

Also, make sure to keep your browser updated and avoid installing suspicious software. It is also recommended to clear app data on mobile devices and scan for malware on your computers regularly. Whitelist trusted websites that rely on redirects for improved security.

If you notice signs of browser hijacking, such as slow loading web pages, unexpected toolbars, redirected searches, pop-up ads, and changes in the default search engine, you may have a browser hijacker. This is a type of malware that alters web browser settings and redirects users to unintended websites.

How to remove WordPress hacked redirect infection?

Here’s a comprehensive guide on how to remove a WordPress hacked redirect infection, compiled from multiple sources:

  1. Scan your site: Use reliable security plugins or online scanners like MalCare, Sucuri’s Sitecheck, or Malcure Malware Scanner. These tools can help you identify malware scripts.
  2. Manual code inspection: Review your site’s source code for suspicious content or variations in files. Pay attention to core files, themes, and plugins. You can inspect the source code of affected WordPress pages without visiting the URL by using the “view-source” format.
  3. Remove malicious files and code: Follow the detailed steps provided in the Sucuri guide:
    • Remove “./wp-blockdown.php” and “./wp-content/uploads/wp-blockdown.php” files.
    • Eliminate injected code responsible for JavaScript spam in the “./wp-blog-post” file.
    • Investigate added or modified files reported by your security plugin’s integrity check.
    • Remove injected JavaScript in modified “./index.php” files.
    • Remove any malicious inclusion in the “./wp-blog-header.php” file.
    • Scan and delete obfuscated JavaScript in the “./wp-includes/js/wp-emoji-release.min.js” file.
    • Use a search/replace SQL command to remove injected JavaScript from database tables like “wp_posts”.
    • Delete any backdoor injectors in the theme’s header.php file and check for bogus admin users in the functions.php file.
  4. Database cleanup: Use tools like phpMyAdmin to search for infected tables and replace the code in the exported SQL file using a code editor like VS Code. Drop the infected tables in phpMyAdmin and import the cleaned-up file.
  5. Check for redirects: After cleaning up the site, clear the cache, visit the WordPress admin area, and test the site in a private browsing window to check for redirections. Monitor the network requests in the Developer Tools’ Network tab.
  6. Identify the root cause: The infection may stem from misuse of database search and replace scripts, vulnerable themes, or plugins. Remove unused and outdated themes and plugins.
  7. Implement preventive measures: Secure your site by shuffling WordPress salt keys, updating and resetting passwords, hardening WordPress, setting backups, scanning computers, and installing a website firewall.

Use MalCare to remove redirect virus

To use MalCare to remove a redirect virus from your website, you can follow the steps outlined below, based on the information provided in the sources:

Malcare plugin scanning wordpress website
  1. Scan Your Website: After installation, you can use MalCare to scan your website for any signs of malware. Symptoms of a redirect virus can include automatic redirects, link redirects, Google blacklist warnings, and user complaints.
  2. Identify Malware: The scan will help you identify areas of your website that have been affected by the malware. This could include various locations such as page headers, the wp_posts table, and others.
  3. Remove Malware: MalCare offers a comprehensive solution for removing malware from your site. This includes the core files, plugins, themes, database, and htaccess files. With the help of MalCare, you can remove all types of malware, including backdoors, redirect hacks, pharma hacks, and JavaScript hacks.
  4. Verify Cleanliness: Once the malware has been removed, you can use MalCare to confirm that your website is clean. It is crucial to ensure that all parts of your website have been cleaned to avoid further problems.
  5. Preventive Measures: After removing the malware, it’s essential to take preventive measures to avoid future infections. This includes using security plugins, changing passwords, reviewing accounts, using SSL, and hardening WordPress. MalCare can help you with these tasks.


We’ve reached the end of this article, and I hope you’ve found it helpful in tackling those frustrating website redirection issues. Now you have a clearer understanding of why these redirects occur and how to fix them.

Remember, when your website is redirecting to another site, it can be a real pain. Whether it’s due to a minor setting error or a more serious hack, the consequences can be severe. Your SEO ranking may suffer, your domain could be blacklisted, and you might lose valuable website traffic and revenue. Not to mention the harm it can do to your brand’s reputation and potential data breaches.

But fret not! Armed with the knowledge you’ve gained here, you can take proactive steps to identify and resolve these redirect problems. Keep an eye out for signs of hacked redirects, such as unsolicited website redirections, Google warnings, or suspicious files on your web server. And don’t forget to follow the prevention tips for your specific browser to minimize the chances of redirects happening in the first place.

If you do find yourself dealing with a WordPress hacked redirect, fear not! We’ve covered a comprehensive guide on how to remove the infection. From scanning your site for malware to manual code inspection, removing malicious files and code, cleaning up your database, and implementing preventive measures, we’ve got you covered. And if you prefer an automated solution, you can use MalCare to scan, identify, and remove the redirect virus from your website.

Remember, prevention is key! Keep your website secure by staying updated, using reliable security plugins, and regularly scanning for malware. Take the necessary steps to protect your website and your visitors’ experience.

I hope this article has empowered you with the knowledge and tools to reclaim control over your website and bid those unwanted redirects farewell. Good luck, and may your website be redirect-free from now on!

Share This Article
Dibbyyan Nath is a well-known entrepreneur, philanthropist, and the Chief Creative Officer of Inteliqo Research and Services. Mr. Nath, over the past two decades, has donned a lot of hats, while writing has remained his first love. Now he aims to express his experiences, as the head of a digital marketing, content creating, and website development company, through his love for writing. To keep up with the young entrepreneur and his thoughts
Leave a comment