Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

At a webshop I'm currently working on I have several links that show a fancybox with product information.

The link works without ajax, it shows the same content as the fancybox links etc will not work.

My question is this, is it considered bad/blackhat to redirect everyone except googlebot back to the page showing the link with a parameter that calls up the fancybox.

eg:

if (($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") && !preg_match("#(google|slurp@inktomi|yahoo! slurp|msnbot)#si", $_SERVER['HTTP_USER_AGENT'])) {

    header("HTTP/1.1 302 Found");
    header("location: " . conf("url:site")."index.php?menu_id=".$_GET['menu_id']."&idproduct=".$_GET['idproduct']."&idlist=".$_GET['idlist']."&fb=1");
    die();
}
share|improve this question
add comment

2 Answers

Google recommends the following in its Webmaster Guidelines:

Don't deceive your users or present different content to search engines than you display to users, which is commonly referred to as "cloaking."

Instead of giving users a hard link to the AJAX data provider script, why not just provide the index.php link by default and use Javascript to enhance the link (i.e. by changing its click event to use your AJAX function call instead of directing the user to the index.php link) as the DOM loads?

share|improve this answer
    
+1 for recommending progressive enhancement –  John Conde Dec 16 '10 at 14:41
    
I'm not the only programmer, and though I'd like to follow best practices its not always possible since work has been started by others before being handed over to me. The redirect simply sends the user back to a page with design and calls the javascript function to call up the popup. The users are still provided the same content as googlebot sees, they're just awarded a little design for not being a bot. –  Kristoffer S Hansen Dec 20 '10 at 8:03
    
@Kristoffer S Hansen but programmers tasked with comparing, say, the rendered content/redirect behavior of a URI when a user with their toolbar installed visits the URI versus the behavior when their bot visits the URI will still algorithmically flag that URI as "cloaked" - unless you know a human will be the judge, it's safer to avoid this behavior. –  danlefree Dec 20 '10 at 23:28
add comment

Anything that you do specifically for the GoogleBot user agent that is different from regular users even if it's not intended to be malicious falls into the realm of cloaking as far as Google is concerned. A better alternative would be to redirect based on the use of JavaScript, IE see if the user has JavaScript enabled and if yes then send them to the JS version if no send then to the non-JS version. Because you are treating all users the same (a regular user without JS enable would be redirected just like GoogleBot is) that meets the quality guidelines.

Obviously this technique can be used by spammers as well so it's best to only use it if there isn't another option. But if you have to go that route remember that Google wants GoogleBot treated like any other user (if it gets different treatment they get cranky).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.