I just made a website for an alcoholic drink. They need to have the age verification on all links. It's a single page website and I use backbone routing system. I've created the check with the SESSION object, so I am loading the intro view (age verification view) if the SESSION object is unset. This is all working as expected, but the problems are google bots. When they are trying to crawl my pages the app is always loading the intro (age verification) view. Here is a link for the website , but I think it won't be very useful, because I guess that this is more a logical then a technical question... So..my question is how to redirect only visitors and to let google bots see the actual content of the page? Should I use cookies or there is a way to achieve this with the php?

有帮助吗?

解决方案

Yes. Something like

If ($_SERVER['HTTP_USER_AGENT'] == "Googlebot") {

$_SESSION['ageverified'] = true;
// do more

}

Should work.

See here for all the exact user-agent names and what they crawl.

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1061943

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top