How can I verify both www and non-www version of a website in WordPress if I'm using Yoast SEO and there is only one verification file upload? I do not have access to the site's GA.
-
You don't want to verify both. Pick one and stick with it (and redirect the other to it).– John Conde ♦Commented Nov 22, 2014 at 22:13
-
5Google WMT wants you to verify both and then pick the preferred version. My non-www is redirected to my WWW already.– CraigCommented Nov 22, 2014 at 22:57
7 Answers
Use an alternative verification method. For example, DNS TXT record ("Domain Name Provider").
-
You shouldn't need to use an alternative verification method since it will be the same verification file for both www and non-www.– MrWhiteCommented Feb 18, 2018 at 12:56
When you verify the 'www' prefix and the 'non-www' prefix using the same Webmaster Tools account, the verification file you download from Webmaster Tools is the same for both. So you only need to upload the single file, then you can verify both.
I had the same problem - I found you just have to add the other version as a Property in Google Webmaster (ie if you have the www version already registered, add the non www version). If you click on Search Console in the upper left, it will take you to one of the initial pages for you to manage your sites, and the option to add another Property is on the top right (red button).
I then chose the same verification method as I used for the initial site (ie the other Property), and Google recognised my ownership of the new version (ie www version in my case). To get to the verification settings, in the newly added Property, first click the gear icon on the top right, then select Verification Details.
You don't need to verify both versions, The best you can do as per the SEO guidelines, 301 Redirect non-www to www using you .htaccess file. Once you are done with doing that do to the webmaster and only enter the URL with www to verify, Once verified you can select the preferred version of your domain to be with www.
If you want to keep the non-www as preferred URL then redirect www to non-www version and verify non-www version of your website in webmaster. Here is the redirection code
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
For more info see https://stackoverflow.com/questions/1659949/how-to-change-htaccess-to-redirect-all-non-www-links-to-www-pages
-
5You don't need to verify both but Google recommends you do. Commented Nov 23, 2014 at 10:10
-
"you can select the preferred version of your domain" - You can only do that when you have verified both www and non-www versions of your site.– MrWhiteCommented Feb 18, 2018 at 12:54
First of all the WWW and NON-WWW for the domain should never be an issues as in the world of the web is it the same, Wordpress and other CMS frameworks have made this to freaking complex over a non issue. If your site is setup right at the web server level it should be able to handle both out of the box. Apache and IIS allow for servername aliasing,
ServerName example.net ServerAlias www.example.net (can have multiple)
If it is handled this way and use relative path on the urls and files then the www or non www is not an issue.
What worked for me is I added both the www and non-www versions of the site I was working on as properties on Google Webmasters tool and verified ownership of both. I then proceeded to choosing the preferred version on the site settings. Done.
-
I'm glad that you were able to verify both, but the question is asking how. Did you have to have a separate verification file for each? Were there redirects involved with the verification file? Did you use a verification method other than the file? Commented Nov 7, 2016 at 14:26
Both verification files are the same filename as same domain, so all you do is verify and upload the html to FTP and thats it.
-
1What does "are the same filename as the domain" mean? Google gives you the same verification file for every domain in your Search Console account. The filename isn't tied to the domain, it is tied to the Google account. Commented Feb 1, 2018 at 9:57