+ Post New Thread
Results 1 to 2 of 2

Thread: How to disallow/ban Google bot to view certain webpage

  1. #1
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,236
    Post Thanks / Like
    Blog Entries
    1

    How to disallow/ban Google bot to view certain webpage



    How to disallow Google bot to view a webpage?

    Here is one idea:
    Code:
    <?
    if(strpos($_SERVER['HTTP_USER_AGENT'],'google') !== false ) { header('HTTP/1.0 404 Not Found'); exit(); }
    if(strpos(gethostbyaddr(getenv("REMOTE_ADDR")),'google') !== false ) { header('HTTP/1.0 404 Not Found'); exit(); }
    ?>
    If user agent contains "google", then header 404 (not found) is sent and script is stopped.
    If IP address host contains "google", then same thing happens.

    ---------
    Similar topic, how to hide part of webpage from bots: https://internetlifeforum.com/html-css-forum/1743-how-hide-link-other-part-webpage-bots-like-googlebot/

  2. #2
    Junior Member ELyon01's Avatar
    Join Date
    Jun 2017
    Posts
    5
    Post Thanks / Like


    Is this useful / helpfull? Yes | No
    Hey there! thanks for that code. Helped a lot.

+ Post New Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam