Www to non-www on Digitalocean setup


#1

Hi, I’m new to Ghost. I used the Digitalocean 1-click installation to setup and noticed the www domain does not redirect to non-www. I’m using example.com and want www.example.com to redirect to it.

There are several posts on the forum about this but ultimately I went back to the documentation here: https://docs.ghost.org/api/ghost-cli/knowledgebase/#ssl-for-additional-domains

That section claims to support www redirects. However, when I got to the

ghost setup nginx ssl

section it gave me this error

Uh-oh! It looks like your domain isn't set up correctly yet. Because of this, SSL setup won't work correctly. Once you've set up your domain and pointed it at this server's IP, try running "ghost setup ssl" again.

Where do I go from here? When I look in system/files I can see that the “www.example.com” conf file was setup. But nothing for SSL.


#2

Did you create a DNS record pointing www at your droplet, and had it fully resolved when you tried the command?

Check those steps and try again :slight_smile:


#3

Yes, I had tried making an A record of www.example.com to my droplet ip address. When I did that it would not resolve with a security certificate and chrome blocked access.

Then I ran the command after. But maybe I didn’t wait long enough? I can try waiting a little longer for the DNS records to update and do it again.


#4

I know it is not ideal, but you can always use CloudFlare to redirect www to non-www.

Both the www and non-www loads on mine, but it does not bother me because the blog is set up on the non-www part. so every link, article or whatever that is clicked will load the right domain.

So the only time they might see www, is if they typed it with www. Any links thereafter loads correctly.


#5

Ok I tried it again, waited for the DNS records to update longer and it worked :slight_smile:

For anyone else with this issue, follow these steps:

Here’s an example of what the conf files look like:


#6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.