Redirect WWW to NON-WWW - Ghost 1 Click Install

November 12, 2017 700 views
Ghost Let's Encrypt DigitalOcean Ubuntu 16.04

So have followed this guide:

All works fine apart from when I try and visit the site with www in the URL.

All the browser says is “Safari cannot open the page because it could not establish a secure connection to the server”

What else do I need to do to redirect WWW to NON-WWW?

I have created an A Record for the WWW in the Domains section of the droplet.

I have also tried editing and adding the www url to the server_name entry and getting the same error.

Please help :(

1 Answer

It sounds like your certificate does not include the www version of the domain, so your browser is rejecting the connection before the server gets a chance to issue a redirect.

If you're using letsencrpyt, leave your non-www domain as server name, add the www domain under ServerAlias, then rerun letsencrypt and check off both domains, so it will create a certificate with both.

Have another answer? Share your knowledge.