Question

Redirect WWW to NON-WWW - Ghost 1 Click Install

So have followed this guide: https://www.digitalocean.com/community/tutorials/how-to-set-up-the-digitalocean-ghost-one-click-application-for-ubuntu-16-04

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 MYDOMAIN.co.uk-ssl.conf and MYDOMAIN.co.uk.conf adding the www url to the server_name entry and getting the same error.

Please help :(

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

https://my-second-domain.com, puede ser https://www.my-second-domain.com

eso es lo único que me hace equivocar, alguien me puede ayudar por favor

Worked like a charm! Just make sure you have to cd to ghost directory (/var/www/ghost) to be able to run cli commands, also you cannot run this as root.

Hey I have the same issue. I am new to ubuntu, terminal etc. I’m sorry how do i edit the config file to add www that the ghost script created when it configured letsEncrypt? I dont see it in the directory, it says its in var folder, but i dont see that. Creating ssl config file at /var/www/ghost/system/files/ghost.digitalocean.love-ssl.conf

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.