# How to setup 301 redirect -non-www to www

**URL:** <https://meta.discourse.org/t/how-to-setup-301-redirect-non-www-to-www/179332>\
**Category:** Self-hosting\
**Created:** [February 11, 2021, 1:03pm UTC](https://meta.discourse.org/t/how-to-setup-301-redirect-non-www-to-www/179332 "2021-02-11T13:03:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)\
**Post date:** [February 11, 2021, 1:55pm UTC](https://meta.discourse.org/t/how-to-setup-301-redirect-non-www-to-www/179332/2 "2021-02-11T13:55:06Z")

</div>

You’d indeed have to install nginx on the host. You can follow these instructions :

> [@Add an offline page to display when Discourse is rebuilding or starting up](https://meta.discourse.org/t/add-an-offline-page-to-display-when-discourse-is-rebuilding-or-starting-up/45238/1):
>
> This guide is intended for advanced users, who are already using nginx outside the docker container. By following this guide you make your setup more complicated

An easier way may be trying something on the dns level, a CNAME redirection (www to non-www yes, the other way around,🤔 not sure though)

---

_[View the full topic](https://meta.discourse.org/t/how-to-setup-301-redirect-non-www-to-www/179332)._
