How to Get Rid of Malware on My Website


A website is commonly attacked through malware injection code. The coding is injected through HTML files or an HTACCESS file. The malware is then spread to anyone who views your website. If you notice a malware or virus warning, immediately clean out your HTACCESS file and all webpage files. Change the main website password and all administrator passwords to scripts installed on the web server.

Cleaning Out HTACCESS Malware

  • Log in to the website's root directory using an FTP program (many are free, such as SmartFTP and FileZilla).

  • Select "Desktop" on the left hand side of the FTP program. Drag the entire "public_html" folder from right hand side to the left side of the screen. This will download all website files from the web server to your desktop.

  • Go to the desktop and double-click on the folder "public_html" to open it. Locate the file named ".htaccess."

  • Right click on HTACCESS file and select "Open With" and "Notepad."

  • Clean out any malicious code found in the HTACCESS file, including redirects and embedded <iframe> code. Save changes by clicking on "File" and "Save."

Cleaning Out HTML Pages

  • Go back to "public_html" folder and locate the file named "index.html" (or "index.php").

  • Right-click on the index file and select "Open With" and "Notepad."

  • Click on "Edit" and "Find" in "Notepad." Search for malicious code by typing in <object>, <embed> and <iframe> in the search field.

  • Clean out any malicious code. Delete malware code from an opening tag, such as "<iframe>," to a closing tag, such as "</iframe>."

  • Save the changes.

Deleting Third-Party Codes

  • Open up individual HTML and PHP files using Notepad.

  • Look for free third-party scripts you have installed. These include free counters or guestbooks.

  • Delete third-party code and all HTML tags associated with a free script.

  • Save changes in "Notepad."

Restore Website

  • Open up the FTP program and log in to the website's root directory.

  • Click on the left-hand side where "public_html" is listed.

  • Drag and drop "public_html" from the left- to the right-hand side of the screen.

  • Confirm that you wish to re-upload website files and publish them.

  • Select "Overwrite existing files" if prompted by the FTP program.

Tips & Warnings

  • Free third-party scripts can carry malicious malware code. These are often seen as pop-ups, advertisements and page redirects. "Third-party" refers to scripts that are not hosted on your web server but are instead accessed at a remote link and hosted by the developer of the script.
  • Uploading a blank HTACCESS file will also delete any malware coding. This option is safe if you do not have any functions or variables in HTACCESS that are necessary for website operations.
  • Do not open up website files using Internet Explorer or Firefox if you are alerted of malware on your website. Opening up HTML and PHP files in a web browser executes malware and allows it to install on your computer. Downloading and opening infected files on the desktop is safe. Malware cannot execute if opened up in Notepad.

Related Searches


  • Photo Credit Thinkstock Images/Comstock/Getty Images
Promoted By Zergnet


You May Also Like

  • How to Clean Malware

    Malware--the collective term used to describe any malicious software, spyware, viruses, key loggers, adware, trojans and other computer programs that are hindrances--has...

  • How to Find Malware on My Computer

    Malware is a catch-all term for any type of malicious computer program, including viruses, worms, Trojans, spyware and adware. Connecting to the...

  • How to Protect a Website From Malware

    Owning and designing websites is an exciting experience. The technology allows web designers to create interesting and dynamic websites. However, every website...

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!