A cloaking script is software which shows one web page to search engines, and another web surfers. The purpose of a cloaking script is to hide the HTML source code which is used to obtain good search engine rankings. The reasons you would want to hide this code from web surfers are that it can be ugly and you don't want unscrupulous webmasters stealing this HTML source code.
Cloaking scripts "intercept" requests for cloaked web pages, and make a decision on whether to show (serve) the optimized or "human version" of a page. If the cloaking script determines that the identity of the requestor is a search engine spider, it serves the optimized version. If the identity of the requestor is not a search engine spider, it serves the human version.
The identity of the requestor can be determined a number of ways. Here are a few methods which cloaking scripts use:
The IP address of the requestor can be compared against a list of IP addresses of known search engine spiders. If the IP address of the requestor matches one on the list, then the cloaking script will know the requestor is a search engine spider.
The IP address method of detection is the most reliable, because IP addresses are extremely difficult to spoof (fake).
The User-Agent (a string of text which identifies the client being used to make the request) of the requestor can be compared against a list of User-Agents known to belong to search engine spiders. If the User-Agent of the requestor matches one on the list, then the cloaking script will know the requestor is a search engine spider.
The User-Agent method of detection is less reliable than the IP address method because the User-Agent header is easy to spoof.
The HTTP_REFERER header can be analyzed and if it is blank, then the cloaking script might think the requestor is a search engine spider.
The HTTP_REFERER method is very unreliable and is not used by commercial cloaking scripts. Many firewalls and proxies strip the HTTP_REFERER header, leading to a good possibility that the request is not a search engine spider even if the HTTP_REFERER header is empty.
Please visit the KloakIt site at http://www.kloakit.com/. KloakIt is a shareware cloaking script.