# Best way to add a 301 redirect

**URL:** https://meta.discourse.org/t/best-way-to-add-a-301-redirect/187257
**Category:** Self-hosting
**Created:** [April 18, 2021, 6:24am UTC](https://meta.discourse.org/t/best-way-to-add-a-301-redirect/187257 "2021-04-18T06:24:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Paul\_King1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paul_king1/32/218888_2.png) [@Paul\_King1](https://meta.discourse.org/u/Paul_King1)
#### Post date: [April 18, 2021, 6:24am UTC](https://meta.discourse.org/t/best-way-to-add-a-301-redirect/187257/1 "2021-04-18T06:24:45Z")

</div>

Could anyone help me with adding a 301 redirect to Discourse.

I would like to redirect www to non-www. I also have sub-domains too.

I have read in someplaces that I need to add a line of code to nginX but I am not really sure how to do this.

I have also been told that I can do this using cloudflare too.

What is the best option and how would I go about doing this please.

Thank you in advance.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 18, 2021, 12:07pm UTC](https://meta.discourse.org/t/best-way-to-add-a-301-redirect/187257/2 "2021-04-18T12:07:21Z")

</div>

One way is [Setting up Let’s Encrypt with Multiple Domains](https://meta.discourse.org/t/setting-up-let-s-encrypt-with-multiple-domains/56685).

---

<div class="post-metadata">

### Author: ![Paul\_King1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paul_king1/32/218888_2.png) [@Paul\_King1](https://meta.discourse.org/u/Paul_King1)
#### Post date: [April 18, 2021, 5:27pm UTC](https://meta.discourse.org/t/best-way-to-add-a-301-redirect/187257/3 "2021-04-18T17:27:32Z")

</div>

Thank you for your help. If I buy and I stall wildcard SSL cert would this also do the same job?

Regards.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 18, 2021, 5:44pm UTC](https://meta.discourse.org/t/best-way-to-add-a-301-redirect/187257/4 "2021-04-18T17:44:02Z")

</div>

Yes, but it will be at least as hard to configure, and you’ll have to remember how to do it every time it expires.
