A lot of people seem to like Air's post [webmasterworld.com], but I've always found it skirted the real purpose of cloaking as it relates to SEOs.... cloaking to obtain better search engine rankings.
Air's example uses the language setting of the browser to selectively serve content in different languages. SEOs are more interested in selectively serving content based on the identity of the requestor.
Here's a simple example of how SEO style cloaking works:
You have a cloaked web page on your server. This 'web page' is actually a CGI script which reads the IP address of the requestor. It compares the IP address of the requestor against a list of IP addresses known to belong to search engine spiders. If a match is found, then the requester is identified as a search engine spider. If no match is found, the requestor is identified as a 'human'.
The CGI script can then selectively serve different content based on the identity of the requestor. If the requestor is human, it can serve the home page of the domain, or some other web page that is not highly optimized. If the requestor is a search engine spider, it can serve a highly optimized web page.
The point of all this is that highly optimized web pages are served to search engine spiders while human visitors get a different web page... all from the same URL.
I have used IP addresses in my example as the method of identification, but the User-Agent string can be used as well (with less reliability).
Now that the mechanics of cloaking have been discussed, I'll get into the risk-management issues. Cloaking is risky. Search engines have publicly stated that they frown on cloaking, and that websites can be punished (with penalties or banning) if caught.
To keep your risks to a minimum, there are several strategies you would be wise to practice: keep your cloaked pages on a separate domain from your primary website, maintain accurate and up-to-date IP lists of the search engine spiders, and keep the cloaked pages out of the search enginges' caches.
What is meant by keeping web pages on a separate domain? Well, you already have a primary website... it is the site you are trying to promote in the search engines. The last thing you want to have happen is to have this site penalized. Get another domain name and host it on a different server. Preferrably, the whois information for this new domain should be different from your primary domain as well. One way to accomplish this legally is to register the new domain under a D.B.A. and have the address be a post office box. This strategy keeps a buffer between your primary domain and your cloaked domain. If this domain is ever penalized or banned for having cloaked pages, your primary domain won't be affected.
The second strategy involves the IP addresses your cloaked pages use to identify search engine spiders. You need to maintain a complete and accurate list of IP addresses. Search engine spiders are always crawling the web from new IP addresses and your cloaked pages need to be able to recognize the new IP addresses. Also, sometimes search engines abandon old IP addresses and these need to be removed from the list.
Many search engines offer a cached copy of a web page they have spidered. The cached copy defeats the purpose of cloaking by showing any human requestor the highly optimized version of your cloaked page. Make sure that you use the ROBOTS NOARCHIVE meta tag on your optimized version of the cloaked pages and exlude any search engines that do not follow this convention.
Finally, let's discuss an important question, "Should you do it?" There is an ethical slant to this question as well as a practical one.
Many folks claim cloaking is sneaky and unethical. Their claim is that you are lying to the search engines about the content of your website in an attempt to get better rankings under keyword phrases the website doesn't deserve. The other side of this argument is that cloaked web pages are trying to provide relevent results to search engines... after all, what webmaster wants irrelevent traffic flooding their server?
The other slant is practicallity. How much time is it going to take you to set up and maintain a cloaking system? Will the traffic it brings be worth the cost of the software (or the time programming your own script) and the cost of the new domain and hosting?
[edited by: volatilegx at 7:21 pm (utc) on June 15, 2004]