Let’s say you own the website http://www.some-example.com. At one point, you might like visitors to go to the non-www version instead of the www version of your domain. In addition to this, if you follow security best practices, you might want to switch from HTTP to HTTPS. What should you do if you want to make both these changes? You probably figured out that you’ll have to redirect traffic from your current domain to your preferred domain. But what’s the best way to do this? Is there a preferred order?
We received an anonymous question for this Ask Yoast:
“I want to move my site from www and HTTP to non-www and HTTPS… what should I do?
1. Strip www and then force HTTPS;
2. or force HTTPS and then strip www?”
Check out the video or read the answer below!
Our SEO for WordPress eBook guides you through every aspect of Search Engine Optimization »
$ 25 - Buy now » InfoHow to switch from HTTP to HTTPS and www to non-www?
Check out the video or read the answer below!
You should do both at the same time. You should redirect the HTTP link straight to the HTTPS version without the www. Don’t try to do that with two 301 redirects, you should do that in just one 301 redirect.
Forcing HTTPS is something that you need to test really well. There are all sorts of things in your site that probably aren’t HTTPS ready that you should know of upfront. I know it was a lot of hard work to get yoast.com to HTTPS and we don’t even have ads. Especially ad services can be really tough to get working on HTTPS. But you should do it in one go. So it’s really secret option number three: redirect from one to the other straight away, and don’t think about anything else.
If you really can do HTTPS for everything and it works fine, make sure to add an HSTS: ‘Strict Transport Security Header’, which forces everything to be over HTTPS. And then, if the browser sees an HTTP link to your domain in the content somewhere, it will still automatically grab the HTTPS version, thus the right one.
Good luck!
Ask Yoast
In the series Ask Yoast we answer SEO questions from followers. Need some advice about SEO? Let us help you out! Send your question to ask@yoast.com.