Treating googlebot as a registered wordpress user?

Discussion in 'Programming' started by hig2, May 8, 2008.

  1. #1
    My anime site is run using wordpress and there are some pages that require users to login before they can access the page- the problem with this is that googlebot will also see the page and index the error message.

    How do I treat googlebot as a registered user so it can access the restricted content?
     
    hig2, May 8, 2008 IP
  2. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #2
    If you don't want google to index those access denied text why don't you restrict the bot access with robots.txt file?
     
    Bagi Zoltán, May 9, 2008 IP
  3. hig2

    hig2 Peon

    Messages:
    564
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Already solved this :)

    For future reference for others that require it..

    <?php if (is_user_logged_in() || eregi("Googlebot",$_SERVER['HTTP_USER_AGENT'])) {

    is the code I used, pretty simple but does what I need.
     
    hig2, May 9, 2008 IP