One issue that I encountered with Google Analytics was a large number of views from sites like or, etc. These really hinder the accuracy of the referral views that come from your Google Analytics. Of course you can block these by editing your .htaccess file and putting in a Rewrite Condition using the following code.

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} 7makemoneyonline\.com [NC,OR]
RewriteCond %{HTTP_REFERER} buttons-for-website\.com [NC,OR]
RewriteCond %{HTTP_REFERER} semalt\.com [NC,OR]
RewriteCond %{HTTP_REFERER} darodar\.com [NC]
RewriteRule .* - [F,L]

However one issue that this didn’t resolved is my ability to test whether these rewrite rules actually worked, so I have brought the code to do that together on this page so that it’s available in the future.

Use the box below to check if my site is blocking referrals from a particular site. Below you will find the PHP code does the referral checking.

echo geturl("", $_POST['referer']);
} else {
function geturl($url, $referer) {

$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg,text/html,application/xhtml+xml';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$useragent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media

Center PC 4.0)';

$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $useragent);
curl_setopt($process, CURLOPT_REFERER, $referer);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);

$return = curl_exec($process);

return $return;


Please let me know if there’s any issues or if this does not work as expected.

# # # # # # #

February 23, 2015

Leave a Reply