Fixing ShareButton.net

MyPost used this as a reference for Social Sharing, but is no longer using Sharebutton.net, Sharebutton.to, or Sharebutton.org.

ShareButton.net or Sharebutton.to or ShareButton.org is a website that allows you to place a javascript code within your code and a set of social media icons will instantly display. It is a free script provided by the creators who ask for nothing in return. Unfortunately, they do actually ask for something in return: that you abide by whatever injection scripts they add. In the case of ShareButton.com, there is no way to purchase or remove these ads without modifying the script to do so.

I have been using ShareButton.net for almost all of my websites including Confessions of the Professions and MyPost as it really makes things so much easier. Unfortunately, there are times where that injection script kicked in and popups would be displayed regardless of whether you wanted them to or not. Sometimes, these scripts were displaying inappropriate ads that do not belong on the site.

In order to remove them, you have to block their links directly using your htaccess file.

The script below will block any unwanted sites, including anything that may be coming from the sites themselves:

Simply add this line:
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?sharebutton.net [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?sharebutton.to [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?sharebutton.org [NC,OR]

Recently, their script added a link to a sex website that I wasn't directly seeing on the page, but I could see it being loaded as one of the websites it loaded. It may be that I have other scripts preventing it from loading, but even so, it is not something I want my visitors to see. So I added this line:
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?sex-paradise.com.ua [NC,OR]

So far, this script is working, as it is telling the htaccess to not allow a connection to your website through these websites, ultimately block them. This makes the sharebutton.net script harmless because it can no longer loads its own scripts except for the actual share script.