Is your Website being redirected to a spam site?
Was just asked by a client why their website was redirected to spam site. I checked the url of the site and it worked fine from my pc. I first suspected it could have been malware on the users pc. This was not the case as the users mobile device redirected as well.
Upon further investigation I was told that the redirect only occurs when the users site is accessed from a link in search results from Google and Bing. I confirmed this to the be case and was able to duplicate the website redirect to a spam site.
How to fix being redirected to a spam site.
The users website was a WordPress site hosted on Godaddy (but this could happen on any webhosting plan). I found that the website was using a 3.X version of WordPress. This is a very old version. I also found that the .htaccess file was edited to include code (I will not be displaying here so no one else can use it) that redirected the website to various spam sites depending on when the site url was listed in search engines. If the link was clicked on and the site was referred from the search engine results the webserver sent the user to the spam site instead of the actual site.
I removed the code from the .htaccess file and cleaned out the cache. I was them able to confirm that the site was working again as usual from search engine results.
It is also work checking to confirm there are no other files that were edited or added at the same date\time as the affected .htaccess file. If there are I recommend deleting those as well. (or renaming them at least)
If you are not comfortable with editing the file directly you could also check the date of the file and restore a copy of the file prior to that date. ( You do have backups right?!!!)
This may not work for all cases but It Fixed it for me.
If anyone has an alternate fix please post it in the comments.