Just installed letsincrypt and it was painfree and works well (thank you!), however I’ve noticed that when I access my site via www.digitalnut.co.uk/ it doesn’t redirect to https.
If I access my site via digitalnut.co.uk/ then it does redirect to https.
Checking my default apache conf file I see that letsencrypt has added ‘digitalnut.co.uk’, but there is nothing to redirect www traffic.
RewriteEngine on RewriteCond %{SERVER_NAME} =digitalnut.co.uk RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
Should (and how!) this rewrite rule be amended to redirect www traffic.
I don’t know what is the rest of your conf and I’m not a big fan of rewrite directives but you could add a new RewriteCond pointing to your www domain.
Thank you, made the change and all is well!
I didn’t add the rewrite rule, presumably added by letsencrypt, and surprised that it didn’t add www by default.
Hi @rossoreed, the Let’s Encrypt client doesn’t add www to any names you request – if you want www.example.com alongside example.com, you need to specify -d example.com -d www.example.com. I think this also applies to setting up redirects in your Apache configuration.
Thanks @schoen
When I installed letsencrypt, I used the command; ./letsencrypt-auto -d digitalnut.co.uk -d www.digitalnut.co.uk --apache -m myemail@gmail.com --redirect --agree-tos
to capture both www and non-www traffic, that’s why I was surprised that Letsencrypt didn’t add a www redirect to my default apache conf file.