# Redirect www to non-www in EC2-powered Ghost

**URL:** <https://forum.ghost.org/t/redirect-www-to-non-www-in-ec2-powered-ghost/16355>\
**Category:** Developer help\
**Created:** [August 7, 2020, 6:53pm UTC](https://forum.ghost.org/t/redirect-www-to-non-www-in-ec2-powered-ghost/16355 "2020-08-07T18:53:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulrberg](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/paulrberg/32/9249_2.png) [@paulrberg](https://forum.ghost.org/u/paulrberg)\
**Post date:** [August 7, 2020, 6:53pm UTC](https://forum.ghost.org/t/redirect-www-to-non-www-in-ec2-powered-ghost/16355/1 "2020-08-07T18:53:13Z")

</div>

## Description

I’m running Ghost on an EC2 instance and I opted for enabling a LetsEncript certificate when going through the initial setup.

The non-www version works well, but I’d like to redirect the www version to non-www. I’m getting this error when trying to access [www.paulrberg.com](https://www.paulrberg.com):

> Your connection isn’t private
> 
> NET::ERR\_CERT\_COMMON\_NAME\_INVALID

I suppose that the issue is that LetsEncrypt didn’t include the www subdomain in its certificate.

How could I solve this?

## Environment

- ubuntu@18.04
- node@12.18.3
- mysql@5.7
- ghost@1.14.1

---

<div class="post-metadata">

**Author:** ![Hannah](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/hannah/32/22_2.png) [@Hannah](https://forum.ghost.org/u/Hannah)\
**Post date:** [August 7, 2020, 6:57pm UTC](https://forum.ghost.org/t/redirect-www-to-non-www-in-ec2-powered-ghost/16355/2 "2020-08-07T18:57:14Z")

</div>

> **[Ghost-CLI - A fully loaded tool for installation and configuration](https://ghost.org/docs/ghost-cli/#knowledgebase)**
>
> The best way to install, manage, and update your site locally or when self-hosting Ghost. A full guide for our advanced CLI tool.

This has been answered on the forum many many times, most notably with extra information here:

> [@SSL not on www after creating ghost installation in direct url (with no www what ever that is called)](https://forum.ghost.org/t/ssl-not-on-www-after-creating-ghost-installation-in-direct-url-with-no-www-what-ever-that-is-called/14498/15):
>
> No CNAME entry needed. My fix (after much patient help from community here) I followed this [Ghost-CLI - A fully loaded tool for installation and configuration](https://ghost.org/docs/api/v3/ghost-cli/knowledgebase/?&_ga=2.209881501.928337693.1592109728-1488256076.1582397450#ssl-for-additional-domains) You then should have two \*-ssl.conf entries in your nginx active domains dir; one will be the original url you setup with and the other will be with or without the www . Then I selected I went to my ghost directory and set the url I wanted as the primary, I went for the direct link (I hae no idea of the fancy names for these with www…

---

<div class="post-metadata">

**Author:** ![paulrberg](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/paulrberg/32/9249_2.png) [@paulrberg](https://forum.ghost.org/u/paulrberg)\
**Post date:** [August 7, 2020, 7:27pm UTC](https://forum.ghost.org/t/redirect-www-to-non-www-in-ec2-powered-ghost/16355/3 "2020-08-07T19:27:00Z")

</div>

Thanks @Hannah and apologies, I missed that.
