: How to verify all https, www and no-www versions with Google Webmaster Tools I recently started a WordPress blog with HTTPS and want some advice. I prefer to use HTTPS + www for my blog.
I recently started a WordPress blog with HTTPS and want some advice.
I prefer to use HTTPS + www for my blog. In order to do that will I have to add all these 4 types of addresses to Webmaster Tools?
example.com http://www.example.com example.com https://www.example.com
If yes, to what specific URL do I need to submit the sitemap.xml file to? Does the same go with XML file also? Do I need to submit all XML files to each domain separately or just to one?
Redirect code in .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ www.example.com/ [R,L]
</IfModule>
More posts by @Speyer207
2 Comments
Sorted by latest first Latest Oldest Best
Yes, you have to add the all 4 variants of links.
In this case you prefer this version www.example.com so adding the sitemap to the preferred version will be enough.
I prefer to use https + www for my blog.
Presumably you have already set up a canonical 301 redirect to www.example.com?
will I have to add all these 4 types of addresses to webmaster tools?
Yes, this is recommended. It then allows you to set the preferred domain (www vs non-www) and to check for any errors (eg. a non-canonical getting indexed etc.).
to what specific URL do I need to submit the sitemap.xml file with?
The canonical property. ie. www.example.com.
Does the same goes with xml file also?
What (additional?) XML file?
Do I need to submit all xml files to each domain separately or just a one?
Once you've added all properties to Google Search Console (formerly Google Webmaster Tools) then you concentrate just on the canonical property. You can periodically check the other properties to make sure there are no errors etc.
UPDATE:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ www.example.com/ [R,L]
This code is not sufficient. This is a 302 (temporary) redirect from HTTP to HTTPS only. It will not redirect the non-canonical example.com (ie. non-www to www). You would need something like the following:
RewriteCond %{SERVER_PORT} 80 [OR]
RewriteCond %{HTTP_HOST} !^www.
RewriteRule (.*) www.example.com/ [R=301,L]
All requests that are either port 80 (ie. not HTTPS) or are not www then redirect to the canonical URL. You need to explicitly include the 301 status with the R flag, otherwise it defaults to a 302. (But it is a good idea to test first with a 302 to make sure it's working, since this won't be cached.) You also don't need the <IfModule> wrapper.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.