Home › Knowledgebase › KB-1232

My website redirects to a malicious page

Summary

This guide helps you troubleshoot and resolve: My website redirects to a malicious page. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

Quick Fix Steps

  1. Visit your website using an incognito or private browser window to confirm the redirect.
  2. Scan your local computer for malware that may have stolen your hosting, FTP, or CMS credentials.
  3. Log in to your hosting control panel and immediately change your FTP, database, and administrator passwords.
  4. Check your DNS records to ensure no unauthorised changes have been made to your A records or nameservers.
  5. Scan your website files for malicious code or recently modified scripts.
  6. Restore your site from a clean backup taken before the compromise occurred.

Detailed Instructions

Do not simply delete suspicious files without first creating a backup. Removing core files incorrectly can break your website entirely. Always download a full site backup before beginning any file modification or deletion steps.

1. Verify the Redirect

  1. Open a private or incognito browser window.
  2. Navigate to your website's domain.
  3. Observe whether the page loads correctly or redirects to an unfamiliar URL.
  4. Check the browser address bar for any security warnings or certificate errors.

2. Scan Your Local Computer

  1. Run a full system scan using reputable antivirus or anti-malware software.
  2. Look specifically for credential-stealing malware, keyloggers, or trojans that may have captured your hosting, FTP, or CMS login details.
  3. If threats are found, quarantine and remove them before changing any website or hosting passwords.

3. Secure Your Hosting Account

  1. Log in to your hosting control panel (for example, cPanel).
  2. Navigate to User Manager or Security settings.
  3. Update your account password, FTP credentials, and database password.
  4. Review the list of authorised users and remove any accounts you do not recognise.
  5. Enable two-factor authentication if your control panel supports it.
  6. Check Cron Jobs or Scheduled Tasks for any unfamiliar entries that may be reinfecting your site or sending spam. Delete any tasks you did not create.

4. Inspect DNS Settings

  1. Log in to your domain registrar or DNS management portal.
  2. Review your A records, CNAME records, and nameserver entries.
  3. Compare the current values against your known correct settings.
  4. If you find unauthorised entries, update them to point to the correct hosting IP address.
  5. Allow time for DNS changes to propagate across the internet.

5. Scan and Clean Website Files

  1. Log in to your hosting control panel and open Files > File Manager.
  2. Sort files by date modified to identify any files changed recently without your knowledge.
  3. Pay close attention to core files such as index.php, .htaccess, and wp-config.php if you use WordPress.
  4. Look for obfuscated code, unfamiliar base64 strings, or suspicious JavaScript injections.
  5. Download a clean copy of your content management system and replace any compromised core files.
  6. Check your .htaccess file for unauthorised rewrite rules and remove any suspicious lines that redirect visitors to spam or phishing pages.
  7. Review server-level redirect configurations outside of .htaccess, such as nginx.conf rules or web.config files if applicable to your hosting environment.

6. Remove Malicious Plugins and Themes

  1. Log in to your website administrator dashboard.
  2. Navigate to the plugins or extensions section.
  3. Deactivate and delete any plugins you did not install or that were recently added without authorisation.
  4. Review your active theme and switch to a default theme if you suspect the current theme has been modified.
  5. Update all remaining plugins, themes, and the core platform to their latest versions.
  6. Go to the Users section of your CMS and remove any suspicious administrator accounts you did not create.

7. Update CMS Security Keys and Salts

  1. If you use WordPress, open wp-config.php in File Manager or via FTP.
  2. Locate the Authentication Unique Keys and Salts section.
  3. Visit the WordPress.org secret-key service to generate a new set of keys.
  4. Replace the existing keys and salts in wp-config.php with the new values and save the file.
  5. This forces all logged-in users, including attackers, to re-authenticate with new credentials.

8. Restore from a Clean Backup

  1. Access your hosting control panel's backup or restoration tool.
  2. Select a backup created before the redirect issue began.
  3. Restore your website files and database to that point in time.
  4. Test your website thoroughly to ensure the redirect no longer occurs.

If No Clean Backup Exists

  1. Manually remove all identified malicious code from your files and database.
  2. Reinstall your CMS core files from a fresh, official download.
  3. Reinstall plugins and themes from official repositories only; do not reuse potentially compromised copies.
  4. Change every password associated with the site, including hosting, FTP, database, and CMS administrator accounts.
  5. Update WordPress security keys and salts as described above.
  6. Monitor your site closely over the following days for any signs of reinfection.

Troubleshooting

Redirect persists after cleaning files

  1. Check your .htaccess file for unauthorised rewrite rules. Malicious actors often insert redirect rules here that send visitors to spam or phishing pages. Download the file, remove any suspicious lines, and re-upload it.
  2. Review server-level redirect configurations outside of .htaccess, such as nginx.conf rules or web.config files.
  3. Check your database for hardcoded site URLs or malicious entries in the options table. For WordPress, inspect wp_options for suspicious values in siteurl and home.
  4. Search your database tables for unfamiliar JavaScript or iframe code that may be injecting redirects into page content.

Security warnings in search results

If Google or other search engines are flagging your site, request a review through the search engine's webmaster tools once you have cleaned the malware. This process can take several days, but it helps restore visitor trust and search rankings.

Hosting account suspended

Some hosting providers suspend accounts when malware is detected to protect other customers. If your site is offline, check your email for a suspension notice from your hosting provider. You will need to clean the infection before requesting reactivation.

Remember — If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket