Https www KO non-www OK on wordpress


I have a self hosted CentOS 7 server with apache and wordpress.
Everything works and it’s set up to work without www so
On my dns i set up a CNAME just to be sure so redirect to

today i ran (WRONG because of www)
./letsencrypt-auto --apache -d
and select “2” to automatic redirect all traffic to https
and i start receive SSL_ERROR_BAD_CERT_DOMAIN trying to visit my website

when i noticed the mistake i run again the correct command
./letsencrypt-auto --apache -d
without www and tried to revoke and delete the first certificate with the www

now i’m in this situation: redirect to and works! works! redirect to and DO NOT WORK DO NOT WORK

(DO NOT WORK means I receive certificate error, with a “continue anyway” i can see website)

Best way to solve this? I don’t wanna destroy server with a wrong command and I’m not an expert so please explain me a bit how to move and where to check
Many thanks

Use both hostnames (with and without www) on the ./letsencrypt-auto` command to get a certificate with both.

You could also have used both certificates separately, but you say you've already deleted the certificate with www.

1 Like

Just tried, no success.

./letsencrypt-auto --apache -d

Congratulations! You have successfully enabled

Now not only the www problem is not solved but even the non-www is broken. I cannot visit my website anymore.

Re-read @Osiris' post:

1 Like

You mean

./letsencrypt-auto --apache -d

no separator between addresses?

The command should look like this...

./letsencrypt-auto --apache -d -d

Thank you

1 Like

i deleted both old certificate and execute command:

./letsencrypt-auto --apache -d -d

but with this result:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apachectl configtest.

AH00526: Syntax error on line 15 of /etc/httpd/conf.d/old_mywebsite-le-ssl.conf:
SSLCertificateFile: file '/etc/letsencrypt/live/' does not exist or is empty

The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError("Error while running apachectl configtest.\n\nAH00526: Syntax error on line 15 of /etc/httpd/conf.d/old_mywebsite-le-ssl.conf:\nSSLCertificateFile: file '/etc/letsencrypt/live/' does not exist or is empty\n",)

line 15 of /etc/httpd/conf.d/old_mywebsite-le-ssl.conf still point to a directory that doesn't exist anymore...

file ‘/etc/letsencrypt/live/’ does not exist or is empty

That may be your error -> so you have to start new.

1 Like

I agree, but the command

./letsencrypt-auto --apache -d -d

shouldn’t start everything from zero? How to delete every attempt and exceute the command in a clean environment? thanks for your patience guys

If you delete the files ending with le-ssl.conf in /etc/httpd/conf.d/ (backing up the existing files is always a good idea!), you should be able to start "fresh".

1 Like


i moved the le-ssl.conf and mydomain.conf in another folder, recreate a new conf file for virtual host with port 80 and execute the command. It worked flawless.

Many thanks guys

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.