Forced login on SEO indexed content

I apologize if I have the wrong category in advance :slight_smile: New to Site Point and PHP

I am building a PHP based website that has specific content. I would like the search engines to index the content, but force a login with any HTTP request.

Would I split this up? I am using PHP/MySQL and sessions for the member login system. Would I use just a robots.txt file and sitemap.xml for the search engines or would this be PHP code I need to consider?

$_SERVER[‘HTTP_USER_AGENT’] would be the easiest way to go about this, below is an example i found…

if (strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot")){

You can find a list of all the major BOTS here

Please bear in mind that the User-Agent string is user controlled and can be easily substituted with one of their choosing.

Ssssssshhhhh, Anthony! Thats a secret! :stuck_out_tongue:

Off Topic:

Ha, damn my loose tongue! Nice to see you back around these parts logic_earth. :wink:

Search engines are going to consider this cloaking and penalize or remove your site from the index completely.
It’s against the Google webmaster guidelines, so you may find the benefits short lived.