0

I am interested in technical considerations I should mind to safely switch my naked domain to a www. subdomain. By safely I mean things like not loosing SEO (redirects will suffice?) or avoiding some redirect loops (I imagine it's not hard to screw this up).

I would like to switch to a www subdomain, as I plan to scale the site up and would like to make use of cookie-less static.mydomain.com subdomain. (Yes, I know I could buy a separate domain for that, but I prefer not to.)

I am aware any cookie that has been already set on the naked domain will be sent to static.mydomain.com anyway. I'm interested in the solution nevertheless, even if only for the future users.

This question is not about DNS setup or server config, but rather general technical considerations I should care about when doing the switch.

If this helps anyone answering the question, feel free to inspect the cookies sent on the current naked domain: http://zadrutowani.pl

I'm aware it's non-SSL, I'm about to drop Wordpress altogether. Currently it's a WP on Apache, it'll be a custom solution on Nginx.

  • 1
    I would simply do a redirect from zadrutowani.pl to www.zadrutowani.pl in your nginx's config (example there; stackoverflow.com/questions/7947030/…) – yagmoth555 Feb 9 '17 at 14:06
  • 1
    I've done similar moves where it turned out users were doing a SSH to the bare domain name and they ended up confused because they were connecting to the wrong thing post-move. Usually better to sort these things out in advance rather than afterwards. – thrig Feb 9 '17 at 17:41
  • 3
    Your site sent me no cookies. Go ahead and flip the switch. – Michael Hampton Feb 9 '17 at 18:51
  • 1
  • 1
    Ah, I have Google Analytics blocked on this browser. In any case that ought not to matter much. You can change the canonical site URL in your Analytics admin settings for the site. – Michael Hampton Feb 10 '17 at 1:30
1

I'm answering the question myself to save the readers having to go through the comments :) (Thank you to all involved!)

In particular case of my naked domain, the only cookies the site sent was Google Analytics (or none, if you had GA blocked in the browser). Hence, @MichaelHampton (btw, the author of yes-www) advised it should be safe to flip the switch and simply add www.

Note there may be an issue for users, who you may have redirected from www to the naked domain before with a 301. In case you'd redirect the naked domain to www now, there could be a redirect loop, of which case is documented here: The 301 'www' nightmare. How do I change back?

However, by inspecting the apache access logs I noticed none of our (30k+ unique) users accessed the site through www subdomain, therefore the 301 redirect from www to naked domain is a non issue.

Additionally, assuming URLs are properly redirected to the new www subdomain (in case adding www is no the only thing you're changing), this should not affect SEO. Remember to change your preferred canonical address in Google's Search Console.

Thank you, Michael Hampton :)! Your comments where key here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.