How to get an email whenever Google visits your site

Do you want to be emailed whenever Google’s spider (GoogleBot) visits your site or your page(s)? If yes, here is an easy way to do it.

I was reading the article - Ever wanted to know when google crawls your site via Digg. The article explains how you to send an email via a PHP Script when Google’s spider (GoogleBot) visits your site. So, why not automate that for each and every page that is PHP powered.

To include the script on every page of your site, let us follow the following steps;

1. Modify your .htaccess file (create if you do not have one) to use the auto_prepend_file feature, it should have this line
php_value auto_prepend_file /home/yourdomain.com/www/html/autoappend.php
(a single line full absolute path to the autoappend.php on your server)
2. Create/Modify your autoappend.php (you are free to change the file name accordingly here and in the .htaccess file) to include the PHP script from swik.net (I’ve modified it slightly to have a clickable url when you get the mail);

<?php //let us notify someone when google crawls this page if ( strpos( $_SERVER['HTTP_USER_AGENT'], ‘Googlebot’ ) !== false ) { // The email address we want to send the email to $email_address = ‘mymail@domain.com’; // Send the email mail($email_address,’Googlebot Visit’, ‘Googlebot has visited your page: http://’.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); } ?>

But, my files extension is not PHP even though my server support PHP, how do I use this?

Well, you can use the same .htaccess to enable PHP for any file extension, you have to add this line

AddType application/x-httpd-php .html .htm

This will parse all files with the extension html and htm as PHP scripts.

References

Update

  1. 2006 June 5 (10:00 am) - Be careful to set a filter for your email for this one. Now, I’m bombarded with “Googlebot Visit” mails!
  2. 2006 June 5 (02:00 pm) - This is perhaps a bad idea for a high traffic website. So, far I have received over 500 emails in just about 5 hours. I’m turning mine off.


Don't like it? There are lots of published articles, pick a random one.

oCricket

Brajeshwar posted this article on Tue, Jul 4th, 2006 at 6:00 pm
Categorized under Technology and has the following tags

Prev Article: Movable Type 3.3

Next Article: Fabrik opens limited beta account


Possibly Related Articles

Archives: Visit the Archives for more articles.

Comments Post Yours

There are one response so far. You can follow any responses to this entry through the RSS feed. You can skip to the end and leave a response. Pinging is currently not allowed.

  1. One thing to watch with this though is that lot’s of spammers, particularly Comment spammers set ‘Googlebot’ to be the user agent so you’ll get a lot of false positives from this I would have thought.

Post yours

Sidenotes

Quick notes, scribbles, somehow related to this website and to what I do. Or perhaps I'm just plain lazy to make them into a full article.

Fedora 10 Released

Let's talk history! Fedora was created in late 2003 as a Linux based Operating System which gives the users an admittance from anywhere in the world to the most up-to-date free and open source software ...28th Nov, 2008

Top 25 Hottest Indian Web Companies

Note: User submitted article. Personally, I would advise not to take this video seriously. 21st Nov, 2008

India gets ready for Free and Open Source Software

Over the years, FOSS.in has attracted thousands of participants, and the speaker roster reads like a "Who's Who" of FOSS contributors from across the world. FOSS.in is a non-commercial event organised and run entirely by FOSS ...21st Nov, 2008

Cooliris for the iPhone

Cooliris is the browser extension that revolutionizes the way you view media on your computer. It is now available as an application for your iPhone! Cooliris for the iPhone allows you to search the web ...22nd Oct, 2008

Adobe releases Flash Player 10 (Mac, Win & Linux)

Adobe have released the shipping version of Flash Player 10 for Mac, Windows and Linux. More about Flash Player 10 * About Flash Player 10 * Get Flash Player 10 (Official Release version 10.0.12.36) * Download Debug and Standalone ...15th Oct, 2008

View the Sidenotes Archive

Play the Penguin Game

Recommended

  • ActionScript 3.0 Reference Flash/Flex ActionScript 3.0 Reference.
  • Forum Oinam’s technical discussion forum where developers and designers can discuss all technical topics.
  • Not Safe for Work Ever clicked a link and felt embarrassed with the content in front of your co-workers? Ever caught unaware because the funny link your friend sent was a little beyond funny? Let’s minimize that with NSWF.
  • o! Just Me Of colorful cultures, entertainment, media, life hacks, music, books and movies from hollywood & bollywood.
  • AS 2.0 Reference Reference for ActionScript 2.0 Programming Language used in Flash. Primarily stashed here for my own personal reference.
  • My Special Job My Special Job is a place where you can look for your weird necessities, strangely superb employees, when your need are more of those hackers, geeks, and ultimate rockstars in the Internet Technology.
  • Downloads All downloads, Free and Open Source.

Download free Brajeshwar Wordpress Theme

Brajeshwar

Brajeshwar I firmly believe in keeping things simple, easy for users and I envison pushing the technical envelop time and again for the betterment of viable commercial and practical applications. More about me.

Brajeshwar's affinity with Adobe

My Photos

More photos on Flickr

Member of 9rules Network

Since its inception on 11th June, 2001, "Brajeshwar" has 897 Articles and 6,106 comments, contained within 21 categories and 1,369 tags.