: How to verify ownership of a site in Google Webmaster Tools through a file? When verifying a site in Google Webmaster Tools, with the recommended method of using a special HTML file, was it
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?
More posts by @Turnbaugh106
2 Comments
Sorted by latest first Latest Oldest Best
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.
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 ^/(.*) ;
return 200 "google-site-verification: $uri";
}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.