physaux Posted August 11, 2010 Share Posted August 11, 2010 Hey guys, I am making a site where certain content will be limited to "members only", where membership is free. Now I want the google bot or whatever bot to be able to see and index this content, but when a user visits it, I want to hide it from them unless they are a member (I already do that). So basically I want to have a function that I can call that will return true or false if the current page is being requested by a search engine spider. I know it's possible because I regularly see forums doing that; posts are hidden unless you register but if you look through the google cached version, the posts are visible. How can I do that? so far all I have is the following, so that the rest of my code works. function is_spider(){ return true; } I read a http://iarematt.com/how-to-detect-a-search-engine-spidercrawler-with-php/ which talks about this, but I don't really trust it... What do you guys think, How can this be done? Link to comment https://forums.phpfreaks.com/topic/210495-how-can-i-detect-a-search-engine-spider-using-php/ Share on other sites More sharing options...
schilly Posted August 11, 2010 Share Posted August 11, 2010 That article looks right. Keep in mind that the user agent can be spoofed easily so the content is not exactly secure from non members. Link to comment https://forums.phpfreaks.com/topic/210495-how-can-i-detect-a-search-engine-spider-using-php/#findComment-1098316 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.