Let's encrypt and non-www to www redirect


#1

How do I set a redirect non-www to www if Let’s encrypt enabled?

server { listen 80; server_name domain.com; return 301 https://www.domain.com$request_uri; }

in /sites-available/domain.com did not work.

K.


#2

go to /etc/nginx/conf.d/force-ssl-yoursitedomain.com.conf and past your code there above the already existing server {

Make sure you test nginx after saving with nginx -t


#3

Does this work as of today ?


#4