Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

When verifying a site in Google Webmaster Tools, with the recommended method of using a special HTML file, was it made so needlessly difficult?

Google explicitly gives you the name of the file on the verification page, but doesn't easily reveal its content — if you follow the link to the file as served by google.com, then the browser will most likely ask you to explicitly save and download it first, instead of showing it as-is within the browser (e.g. google must be serving the file with something like Content-Disposition: attachment; filename=googleXYZ.html HTTP header).

If you instead copy/paste the link to the file from the browser to the terminal, and use wget on the server to fetch the file that had to end up on the server anyways, then, apparently, a wrong version of the file is fetched (user session doesn't match?), and verification fails. After failing to verify the site, Google Webmaster Tools interface is nice enough to show you what exactly the content of such a wrong file on your server is, but still doesn't actually tell you what the content should instead be for the verification to succeed!

What's special in these files that they have to be downloaded from Google onto a desktop, and then uploaded from the desktop onto a server?

What if my desktop doesn't let me download any files? My upload bandwidth is very limited? Establishing a new filetransfer session is too expensive or insecure? Or I simply do all my development in the cloud, and can't be bothered to explicitly upload something to the server, instead of downloading it on the server directly? Any easier way to verify a site in Google Webmaster Tools through a file?

share|improve this question
add comment

2 Answers

What gives? What's so special in these files that they have to be downloaded from Google onto a desktop, and then uploaded from the desktop onto a server?

Because that is a standard and common workflow for most websites. You develop locally then push to a server. Usually it's through FTP but git is pretty popular nowadays.

Even if you are on a slow connection, the file is only a few bytes. It should be quicker to download from GWT and upload to your site than it is to load a regular web page. I honestly can't see what is so difficult here.

share|improve this answer
    
How exactly do you download and save a file on, say, an iPad? –  cnst Feb 10 '13 at 18:36
    
@cnst simple - you do web development work on a desktop computer, not an iPad ;) Or just use a different verification method, that's exactly why Google provides several different methods. –  DisgruntledGoat Feb 11 '13 at 12:03
add comment
up vote 1 down vote accepted

It turns out, the file is simply formed as follows:

For a file named /googleXYZ.html, the contents would be google-site-verification: googleXYZ.html.

So, instead of downloading the file from Google to the desktop, and then uploading from the desktop to the server, repeat for every domain, the following script could be used to automatically generate correct files based on the filename alone.

env F=googled1085b59adc211cb.html sh -c 'echo "google-site-verification: $F" > $F'

Or, with nginx, the following could be used within the server context:

location = /googled1085b59adc211cb.html {
        rewrite ^/(.*)  $1;
        return 200 "google-site-verification: $uri";
}
share|improve this answer
    
Those files are very simple. Glad you found your solution. –  Stephen Ostermiller Feb 9 '13 at 10:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.