http-redirectmeteornginxmeteor-up

Redirect www to non-www with Meteor and Meteor UP


How do I redirect everything on www.site.com to site.com?

I use MUP to deploy my application to Digital Ocean. So far I am thinking of either adding a CNAME for www (couldn't get that to work), or add a meteor package that redirect server side (something like wizonesolutions:canonical), or SSH into the server and change NGINX manually.

What is the recommended approach for doing this?


Solution

  • I forgot to mention that I use SSL (HTTPS). With that it's not possible to redirect with a CNAME in the domain settings.

    I could not change the NGINX settings since every time I deployed, the container got replaced with a new one and MUP itself does not have any settings for this.

    The recommended and very nice solution was to use wizonesolutions:canonical. Just remember to set ROOT_URL variable in the mup.js setup file to the desired URL (https://www.yourdomain.com or https://yourdomain.com)