google webmaster tools - verify by obscure html using path_redirect module

bcswebstudio - January 25, 2007 - 15:31

Thought this was a neat tip to share (and open the door for criticism if anyone discovers holes).

Google Web Master Tools has a host of free, cool tools for webmasters, but in order to kick it off, you have to verify site ownership by one of a few methods. I chose to do the html file verification.

This method requires the site owner to upload an empty html file to your site with an obscure name specified by Google site verification. A typical name looks something like: googlefee02bb11aa1976.html (this is a made-up code). Rather than creating a file, I instead used the module path_redirect to redirect that filename request to root (/) with a 302 status.

Worked like a charm, and I did it all from within Drupal-- no messing with the file system nor ftp.

Another way to verify your

andyceo - January 5, 2008 - 17:34

Another way to verify your site ownership:

Make a PHP-block,

Enter to body of block:

<?php
drupal_set_html_head
('<meta name="verify-v1" content="fmX1YhAzQ20sKTBkoEAa3W+h432WiBjtbyM78gi0V/o=" />'); //for Google
drupal_set_html_head('<meta name="y_key" content="ec64d4a23b420294" />'); //for Yahoo
drupal_set_html_head('<meta name="yandex-verification" content="6dcc2d578ba99b72" />'); //for Yandex
drupal_set_html_head('<link rel="openid.server" href="http://andyceo.ruware.com/openid.php" />'); //     for OpenID server
drupal_set_html_head('<link rel="openid.delegate" href="http://andyceo.ruware.com/openid.php" />'); // for OpenID server
?>

And show block only for anonymous and only on front page.

Two last strings:

<?php
drupal_set_html_head
('<link rel="openid.server" href="http://andyceo.ruware.com/openid.php">'); //     for OpenID server
drupal_set_html_head('<link rel="openid.delegate" href="http://andyceo.ruware.com/openid.php">'); // for OpenID server
?>

you need if you have an OpenID server script (like that - http://siege.org/projects/phpMyID/ ) on your server. Otherways, you can delete them.

PS: It can be useful:

Webmaster's center of Google: http://www.google.ru/webmasters/
Webmaster's center of Yahoo: https://siteexplorer.search.yahoo.com/

PPS: Thanx this post for information: http://drupal.org/node/197788#comment-648624

Thank You

mdj - March 10, 2008 - 22:19

Thanks, A quick and easy fix. Just what I was looking for.

Tried and failed

vdowsett - March 23, 2008 - 15:35

Hi I have tried the above method to get Google Verification. I keep getting the following error:

Verification status: NOT VERIFIED
Last attempt Mar 23, 2008: We've detected that your verification file returns a status of 500 (Internal server error) in the header.

This is the code I used:

<?php
drupal_set_html_head
('<meta name="verify-v1" content="fmX1YhAzQ20sKTBkoEAa3W+h432WiBjtbyM78gi0V/o=" />'); //for Google
?>

I have also tried to upload the html file using ftp. That didn't work either.

Any ideas? Thanks

can't get google to verify

cazam - April 29, 2008 - 13:47

Hi there, thanks for your post, it looks great but unfortunatelly I can't get it to work.
Do i need to add any special code to create a PHP-block or it's just like any other block?
i created the block and amde it visible only for anonymous and only on , now where should i make the block "appear" ex: letft side bard, right side bar, content, ...
i've tried all the possible places and none of the work, in some of them I get google to see it but it says that the metatag is in the wrong location, and in others google can't even se it.
and also the block apears on the page, which is not acceptable couse I don't wan't people to go to the page and see the block.
thanks
Kadu

To you and previous orator

andyceo - May 9, 2008 - 18:53

Of course, you need your own google code, you can get it in your google account.

<?php
drupal_set_html_head
('<meta name="verify-v1" content="_YOUR_GOOGLE_CODE_" />'); //for Google
?>

500 Internal Server Error mean that your server have a problems to process the requests. Does your site accessible from browser?

When you create a block, you must choose the PHP-filter for correct work.

There is no any difference where you place the block, cause it didn't show anything, it working with Drupal core API.

After all your preparations, you must to refresh Drupal cash - go to Themes menu item in the admin panel (/admin/build/themes)

Then, logout and load the main page. look into the html source and search fo your google code manualy. if you can find it, it mean the code is work right. Google must find it. If Google can't accept you as ownership, but manualy check show that Google code presents, request the Google support.

If you can't find manualy the Google code, it mean that you made something wrong in above steps.

Thanks a lot, worked like a charm

Revital - August 12, 2008 - 20:06

Cheers!

Thanks

the1who - June 12, 2008 - 03:39

Works for me, very easy! Thanks!

Matthew

Could you show an example of use path_redirect?

dodiiriyanto - March 6, 2008 - 04:23

I little bit confusing how to using pathr redirect, because there are so many redirect type to implemented in my web. Thanks...

 
 

Drupal is a registered trademark of Dries Buytaert.