So I run the following command and given a list of domains that I would like to activate HTTPS for. However, the domain I would like to activate HTTPS is example.com, instead of blog.example.com. How can I do that? Or will it be the same for both domain and sub-domain to get activated?

~# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?


1: blog.example.com
2: www.blog.example.com


Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter ‘c’ to cancel):

I have checked out this: https://wordpress.org/support/article/changing-the-site-url/ but the instruction does not seem to be straightforward enough for my issue.

Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello, @sawthinkar

Could you please let me know if you’ve already changed the domain name used for the WordPress site from blog.example.com to example.com? If that is correct you can also alter the Apache configuration file and change the domain from blog.example.com to example.com in the server block as well.

In this way certbot can issue a SSL Certificate for example.com as per your wish.

I will recommend you to create a snapshot of your droplet and also backup your data in order to have a working copy of your site (both files and database) in case something goes wrong.

If you haven’t changed the domain name yet, let me know and I can try to explain the process in details.

Regards,
Alex

  • Hey, @alexdo

    1) I tried adding these lines of code in wp-config.php thus it made the domain configuration in the Wordpress admin panel locked.

    define( 'WP_HOME', 'http://example.com' );
    define( 'WP_SITEURL', 'http://example.com' );

    2) So again I updated the database using these commands in the server terminal.

    mysql> UPDATE wp_options
        -> SET option_value = 'example.com'
        -> WHERE option_name = 'home';
    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> UPDATE wp_options
        -> SET option_value = 'example.com'
        -> WHERE option_name = 'siteurl';
    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    

    3) I even tried git cloning var/www/html into my local machine to see if there were any codes edited in a hardcoded way, but nothing seemed to be edited as blog.example.com.

    4) It just kept showing me blog.example.com and www.blog.example.com when I tried certbot --apache again. I tried rebooting the droplet too. So finally, I destroyed that droplet and build a new One-Click Wordpress droplet again.

    It would be really cool if you could explain to me what is going on behind there I was missing out on.

    Yes, I would like to know more about this. If that is correct you can also alter the Apache configuration file and change the domain from blog.example.com to example.com in the server block as well.

    Thanks for this suggestion. I will keep that in mind next time. I will recommend you to create a snapshot of your droplet and also backup your data in order to have a working copy of your site (both files and database) in case something goes wrong.

    • Thanks for getting back to me.

      My assumption is that the domain name was still listed as blog.example.com in the Apache virtual host, e.g

      <VirtualHost *:80>
      
          ServerName blog.example.com
      </VirtualHost>
      
      <VirtualHost *:80>
      
          ServerName www.blog.example.com
      </VirtualHost>
      

      hence cerbot kept showing you this and not example.com

      What you can do is to open the Apache configuration file for the domain name and make sure you have the correct domain name listed in the ServerName block and then restart apache and give another go with certbot.

      Regards,
      Alex

Submit an Answer