DNS TXT record is the best way to verify all subdomains/subdirectories on your domain name in Google webmasters tools, now Google Search Console. We have been verifying our GWT account by uploading an HTML file on the server in the root folder.
We avoided the META tag in the HEAD, as it become publicly visible. But the DNS verification is a better way.
Many webmasters host multiple subdomains for varying purposes like forums, microsites, blogs, etc. Google provides many ways to verify sites – but due to varying modes in which you might be hosting the sites, many times it is difficult to add the Google verification code in meta tags in the HEAD area, or add Google analytics code in the HEAD area or upload an HTML file in the root server.
Many times you use CNAME for blogs/job boards to give the appearance that you host the site on your own subdomain. How to verify those?
Google DNS TXT Verification
Here is the best part – If you verify your domain, ALL subdomains and subdirectories are automatically verified and it is the best way to claim ownership of your entire site completely, without the need to keep adding tags and uploading files to each sub-domain
Obviously, you need to have control of your DNS settings, which most domain hosting providers provide access to.
Go to site verification options in Google webmasters tools. Choose the domain you want to verify.
After choosing Domain Name Provider, we could not find our web hosting provider there, so we choose “Other”.
Then Google gives a long txt code that needs to be added to the DNS TXT settings of the domain name. Copy it correctly, and paste it into Notepad to keep ready for use in the DNS settings.
How to add DNS TXT record?
Login to your server WHM and go to DNS Settings > Edit DNS Settings > Choose Domain.
Now we add a new TXT field to the domain name. Note your domain name should be followed by a dot. We use 300 sec as it will propagate DNS faster and make Google grab the verification faster.
Enter the value provided by Google within double quotes (” “) in the form field marked “Text information”.
After you save the new DNS settings, the DNS propagation will occur quickly (you can check using WhatsMyDNS) and you can click verify. Now the domain will be verified and you can confirm.
If you had previously added multiple subdomains and subdirectories to be individually tracked in GWT, they will ALL be automatically verified too. Try it for yourself.
Another great idea is to verify your site in the free Ahrefs webmaster tools and get all useful SEO data about your websites.