# Https www KO non-www OK on wordpress

**URL:** <https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299>\
**Category:** Help\
**Created:** [July 21, 2018, 4:38pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299 "2018-07-21T16:38:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcom](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pcom](https://community.letsencrypt.org/u/pcom)\
**Post date:** [July 21, 2018, 4:38pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/1 "2018-07-21T16:38:26Z")

</div>

Hello,

I have a self hosted CentOS 7 server with apache and wordpress.  
Everything works and it’s set up to work without www so [http://mydomain.com](http://mydomain.com)  
On my dns i set up a CNAME just to be sure so [www.mydomain.com](http://www.mydomain.com) redirect to [mydomain.com](http://mydomain.com)

today i ran (WRONG because of www)  
./letsencrypt-auto --apache -d [www.mydomain.com](http://www.mydomain.com)  
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 [mydomain.com](http://mydomain.com)  
without www and tried to revoke and delete the first certificate with the www

now i’m in this situation:  
[http://mydomain.com](http://mydomain.com) redirect to [https://mydomain.com](https://mydomain.com) and works!  
[https://mydomain.com](https://mydomain.com) works!  
[http://www.mydomain.com](http://www.mydomain.com) redirect to [https://www.mydomain.com](https://www.mydomain.com) and DO NOT WORK  
[https://www.mydomain.com](https://www.mydomain.com) 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

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [July 21, 2018, 4:41pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/2 "2018-07-21T16:41:37Z")

</div>

> [@pcom](#):
>
> Best way to solve this?

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`.

---

<div class="post-metadata">

**Author:** ![pcom](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pcom](https://community.letsencrypt.org/u/pcom)\
**Post date:** [July 21, 2018, 4:53pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/3 "2018-07-21T16:53:39Z")

</div>

Just tried, no success.

./letsencrypt-auto --apache -d [www.mydomain.com](http://www.mydomain.com)  
…  
…  
Congratulations! You have successfully enabled [https://www.mydomain.com](https://www.mydomain.com)

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

---

<div class="post-metadata">

**Author:** ![danb35](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/danb35/32/70869_2.png) [@danb35](https://community.letsencrypt.org/u/danb35)\
**Post date:** [July 21, 2018, 4:56pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/4 "2018-07-21T16:56:14Z")

</div>

> [@pcom](#):
>
> ./letsencrypt-auto --apache -d [www.mydomain.com](http://www.mydomain.com)

Re-read @Osiris' post:

> [@Osiris](#):
>
> Use both hostnames (with and without `www` ) on the ./letsencrypt-auto` command to get a certificate with both.

---

<div class="post-metadata">

**Author:** ![pcom](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pcom](https://community.letsencrypt.org/u/pcom)\
**Post date:** [July 21, 2018, 4:57pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/5 "2018-07-21T16:57:23Z")

</div>

You mean

./letsencrypt-auto --apache -d [www.mydomain.com](http://www.mydomain.com) [mydomain.com](http://mydomain.com)

?  
no separator between addresses?

---

<div class="post-metadata">

**Author:** ![stevenzhu](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/stevenzhu/32/18864_2.png) [@stevenzhu](https://community.letsencrypt.org/u/stevenzhu)\
**Post date:** [July 21, 2018, 4:58pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/6 "2018-07-21T16:58:50Z")

</div>

> [@pcom](#):
>
> ./letsencrypt-auto --apache -d [www.mydomain.com](http://www.mydomain.com) [mydomain.com](http://mydomain.com)

The command should look like this...

`./letsencrypt-auto --apache -d www.mydomain.com -d mydomain.com`

Thank you

---

<div class="post-metadata">

**Author:** ![pcom](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pcom](https://community.letsencrypt.org/u/pcom)\
**Post date:** [July 21, 2018, 5:11pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/7 "2018-07-21T17:11:32Z")

</div>

i deleted both old certificate and execute command:

> ./letsencrypt-auto --apache -d [www.mydomain.com](http://www.mydomain.com) -d [mydomain.com](http://mydomain.com)

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/www.mywebsite.com/cert.pem' 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/www.mywebsite.com/cert.pem' 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...

---

<div class="post-metadata">

**Author:** ![JuergenAuer](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/juergenauer/32/26491_2.png) [@JuergenAuer](https://community.letsencrypt.org/u/JuergenAuer)\
**Post date:** [July 21, 2018, 5:29pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/8 "2018-07-21T17:29:07Z")

</div>

> [@pcom](#):
>
> i deleted both old certificate

> file ‘/etc/letsencrypt/live/www.mywebsite.com/cert.pem’ does not exist or is empty

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

---

<div class="post-metadata">

**Author:** ![pcom](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pcom](https://community.letsencrypt.org/u/pcom)\
**Post date:** [July 21, 2018, 5:32pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/9 "2018-07-21T17:32:42Z")

</div>

I agree, but the command

```
./letsencrypt-auto --apache -d www.mydomain.com -d mydomain.com

```

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

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [July 21, 2018, 5:43pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/10 "2018-07-21T17:43:46Z")

</div>

> [@pcom](#):
>
> How to delete every attempt

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".

---

<div class="post-metadata">

**Author:** ![pcom](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pcom](https://community.letsencrypt.org/u/pcom)\
**Post date:** [July 21, 2018, 6:04pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/11 "2018-07-21T18:04:38Z")

</div>

IT WORKS!

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [August 20, 2018, 6:04pm UTC](https://community.letsencrypt.org/t/https-www-ko-non-www-ok-on-wordpress/67299/12 "2018-08-20T18:04:40Z")

</div>

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