Error getting SSL certificate

You can also try it this way:

  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
5 Likes

Hi there again guys. I have tried both your suggestions for redirection and although they redirect severindouble.com and http://severindouble.com they do not redirect http://www.severindouble.com and https://www.severindouble.com or www.severindouble.com; it comes up with the error: SSL_ERROR_BAD_CERT_DOMAIN. I understand that this is, maybe, a little bit trite, but some people have the tendency to still use the www, even though it is not needed. I have added the line: RewriteCond %{HTTP_HOST} ^(www.)?severindouble.com from code at godaddy.
This seems to work in redirecting it to https;//www.severindouble.com, but it still comes up with the bad certificate error.

I think I know why the .htaccess file wasn't working before; basically because there is RewriteEngine on code in 000-default.conf (which I think certbot puts in there), which I must admit I messed up putting the code from godaddy in, and didn't back it up. When I went to restart apache, it bombed out with an error. I notice, you noticed that apache wasn't listening on port 80, rather 8081. I must admit, I cannot remember why I changed this, but I have now got the default, 000-default.conf code.

In essence, I'm not sure why it is coming up with the bad certificate error when redirecting to https://www.severindouble.com, but if you could modify and send me the code to redirect it to https://severindouble.com when users type in http://www.severindouble.com and https://www.severindouble.com, I suppose that would be sufficient

I must admit I've never fully got to grips with regular expressions. Any and all help much appreciated

mmmm, is the reason why it's not working at https://www.severindouble.com, because I stripped out the code that (I think) certbot put there in 000-default.conf. Interesting, the redirect to https://severindouble.com from https://www.severindouble.com, http://www.severindouble.com and www.severindouble.com seems to work on chrome, on my mobile, but not firefox on linux, even after clearing out the cache, it still comes up with the bad certificate warning. LOL, this is why I gave up web design; because you have to test it on all the browsers, in all resolutions, on all different platforms, including, the multitude of mobile phones. LOL, hair pulling out time

LOL, maybe this is as good as it gets

Because you have a cert with only the name severindouble.com in it. You need to recreate the cert to also include the www name.

3 Likes

How do I do that? When I run sudo certbot --apache, it only lists severindouble.com to 1 attempt to reinstall existing certificate and 2 renew and replace the certificate. Sorry to be a pain

You need to add a ServerAlias directive in your apache config.

(or you can just tell certbot the domain names manually)

2 Likes

Sorry. How do I tell certbot domain names manually?

certbot [your options] -d example1.example.com -d example2.example.com

(or there should be a way in the interactive mode, if you just write them instead of choosing by telling it numbers.)

1 Like

Cheers me dears. All sorted now. Thank you, one and all (apart from the supposed russian interloper). Happy bunny :grin:

2 Likes

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