Please share :

Cloacking is black hat (spamdexing) SEO Technique. In This technique we built versions(view) of same page, one for search engine and other is for real visitors. There are various techniques for Cloaking.

Different Cloaking Methods

  • IP address Cloaking
  • User-Agent Cloaking
  • HTTP_REFERER Header Cloaking
  • JavaScript Cloaking

IP address Cloaking –

This method is based on IP address of search engines. you can place following code in your website for cloaking purpose.

PHP code of Cloaking

Example  of cloaking in php

// replace ip address with real ip address


if ($_SERVER[‘REMOTE_ADDR’] == ‘IP address here’) {

echo “Shows normal version of page “;

} else {

echo “After Cloaking effect “;

} ?>

// ———————- —-        or use following code for multiple IP address

$arrayofip = array(“ip1”,”ip2”,”ip3”);

if (in_array($_SERVER[‘REMOTE_ADDR’],$arrayofip)) {

echo “Normal View”;

} else {

echo “After Cloaking effect”;

} ?>

// ———————– where to find IP address

You can also use above code in wordpress 

User-Agent Cloaking –

Cloaking on the User Agent consists of performing a specific action based on the user agent of the visitor.


$uaGoogle=”Googlebot/2.1 (+”;

print(“this is for search engine Google Bot”);
print(“This is for visitors”);


HTTP_REFERER Header Cloaking –

Some black hat cloak according to the keywords entered in the search engines. Thus it is possible to sell motor traffic via SEO as the sponsored link!

PHP Script for HTTP Ref


$referer = $_SERVER[‘HTTP_REFERER’];

print(“Hi visitor who comes from the site”;

print ($refererSite);
print(“this is for visitor”);

JavaScript Cloaking –

users with JavaScript enabled browsers are shown one version while users with JavaScript turned off (like search engines) are shown another version of a website.


Google guide lines for cloaking 

Be careful, do not believe that after reading this article, you will be able to cloaker everything and anything without risk. Black hat Technique because its violate basic search engine guideline of serving quality content to user. It is not advisable to apply cloaking on any website. It is right that if you use cloaking in the wrong way, with wrong purpose , Google and other search engines may remove you from their index, and may be you find penalty from search engines.


Please share :

1 comment

Leave a Reply