When I click on my site in Google search results I am redirected to a malicious site but it works fine when I enter my URL in the browser address bar. Are you Facing this issue in your website ? If yes then your website is hacked and you need to scan your website and remove that harmful code from your website , this problem will occur in any type of website but generally wordpress user face this ,
There is some malicious script added in your INDEX.PHP OR HEADER.PHP which is done by hacking template file , they do this if your file permission is not correct , set correct file permisison for all files so that no one can access and edit your files without cpanel or ftp access.
- Try this Free File Viewer site to find harmful and malicious code in your website.
How to Protect Website from Malware attacks
- Regular automated backups of your database and files.
- Using strong passwords for your database, ftp, shell.
- Strong File Permissions 644 for all
- Deleting unused files and folders.
How to protect your WordPress website from Malware
Your wordpress blog or website can be infected in 5+ general ways.
- Someone steals FTP /SSH password, so change them. Also, make sure you do not leak Mysql passwords
- Bad permissions in server (make sure group and other can not write to theme files) and server is infected.
- You got a malicious user (check user list in wordpress. Make sure you have no duplicate users, and maybe change your own password).
- Vulnerability in plugins or wordpress (update all to latest version)
- Go through plugin list and delete plugins you do not know or use.
How to Clean Remove Virus Script from WordPress
If you are geting this issue again and again in your wordpress website then i will suggest you to update whole wordpress again , backup your wordpress wp-config.php file and update the whole wordpress again. If you are new and don’t know how to do it then we will do this for you at a very little cost of $10.
This script will be installed in two place either in your theme folder or in plugin folder or in WordPress install.So if you are attacked again and again then you need to reinstall your wordpress again.