Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stocksph's avatar

www not working on letsencrypt ssl

Hi,

     I just used larage forge and installed letsencrypt ssl and it works perfectly fine on non www domain.
     but when i sed www.domain.com it redirects to domain.com only

     My goal here is if a visitor enters domain.com it should go to www.domain.com

     Right now, without the www it works perfect. but when you entered www.domain.com it doesnt.

     Please help.

     Any help is highly appreciated.

Sincerely

0 likes
3 replies
jekinney's avatar

Most domains are set that way as www. Is just more typing. Just reverse the redirect.

mstnorris's avatar

It looks like you haven't set up the www CNAME redirect.

This is the reason it isn't working as LetsEncrypt tries to access www.yourdomain.com but can't (as you haven't set up the DNS correctly).

How are you managing your DNS? It may be directly with the company where you bought your domain name from or it might be through your hosting provider, or even another company altogether. In any case, you should find where your DNS is managed, and add a CNAME record: WWW should go in the name field, and your domain name (without the www) along with a period at the end, should go in the hostname field. Like so:

DNS

1 like
stocksph's avatar

I'm managing it on my digitalocean account.

  • and www are in cname values on my account.

cname key: * cname value: @

cname key: www cname value: @

@ = yourdomain.com.

I really would appreciate if someone can post their non-www and www domain config file for me to use as a basis to make www preferable.

Any help is highly appreciated.

Sincerely

Please or to participate in this conversation.