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.
Comments
Another way to verify your
Another way to verify your site ownership:
Make a PHP-block,
Enter to body of block:
And show block only for anonymous and only on front page.
Two last strings:
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
Thanks, A quick and easy fix. Just what I was looking for.
Tried and failed
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:
I have also tried to upload the html file using ftp. That didn't work either.
Any ideas? Thanks
disable caching
make sure you disable caching temporarily, so that google doesnt see your old cached homepage instead:
1. go to yoursite.com/admin/settings/performance and disable cache
2. logout and check the homepage to ensure your meta tag can be seen in the page source
after youre done with google verification, you can re-enable caching.
can't get google to verify
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
Of course, you need your own google code, you can get it in your google account.
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
Cheers!
follow-up questions
andyceo, thank you very much for your explanation. I have a couple of follow-up questions. I'm still kind of a newbie, haven't learned php yet, so this might be a stupid question, but if you don't ask, you'll never know, right?
You said it doesn't matter where the php block is placed, and there is a mention above of themes. Would it make sense to add this block to the index.php file? Would that make it useable regardless of the theme? Or is that a bad idea?
I'm assuming you still have to do the redirect to root discussed above?
Thanks so much for your help-
Robin
Thanks
Works for me, very easy! Thanks!
Matthew
How to get this working in Drupal 6.x
I assume this works for Druapl 5.x. I tried it under Drupal 6.x but it does not work. Any idea how to implement this under Drupal 6?
Thanks.
Could you show an example of use path_redirect?
I little bit confusing how to using pathr redirect, because there are so many redirect type to implemented in my web. Thanks...
Both path_redirect or with
Both path_redirect or with block and set meta tags are great for Google verify. This mean there is no file to copy when upgrading Drupal. Good idea.
Is there any good way to handle Yahoo and MSN LiveSearch? They both use files with specific content inside them.
I know it's a new comment on
I know it's a new comment on an old post, but I'd suggest trying the new Site verification module that works for nearly all search engine verifications.
path_redirect for multiple webmasters
I'm putting in another plug for the path_redirect way of addressing this issue. One concern is that Google (for example) will only allow one verification tag. So if you have multiple persons with webmaster tools access to your site only one of them would be able to verify using meta tags.
One thing to note is that you should use <front> to redirect to the homepage rather than / in the path redirect admin.
Using the slash (at least for me) creates an extra slash at the end of the URL.
Thanks for the tip!