Posted in

Securing Your WordPress Site with HTTPS: A Step-by-Step Guide to Using Let’s Encrypt

https, website, internet

To use Let’s Encrypt to enable HTTPS on a WordPress website, you will generally follow these steps. The process can vary depending on your hosting environment, such as a shared host, a VPS, or a dedicated server.

Step 1: Check Hosting Provider Support

First, check if your hosting provider supports Let’s Encrypt. Many hosts offer an easy integration directly from their control panel.

Step 2: Access Let’s Encrypt via Control Panel

If supported by your hosting:

  1. Log in to your hosting control panel.
  2. Look for the Security section or a dedicated section for SSL/TLS management.
  3. Select Let’s Encrypt or a similar SSL option.
  4. Follow the prompts to install the certificate on your domain. This usually involves selecting the domain from a list and simply clicking “Install” or “Apply”.

Step 3: Manual Installation on Unsupported Hosts

If your host does not support Let’s Encrypt, you may need to manually install the certificate. This is more complex and typically requires shell access:

  1. SSH Access: Log in to your server via SSH.
  2. Install Certbot: Certbot is the official Let’s Encrypt client for managing your SSL certificates. Install Certbot by running:
    sudo apt-get update sudo apt-get install certbot python3-certbot-apache

    (This command is for Debian/Ubuntu systems. Adjust accordingly for other OS.)

  3. Obtain the Certificate: Run Certbot with the following command to get and install an SSL certificate:
    sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

    Replace yourdomain.com with your actual domain name. Certbot will modify your Apache configuration to use the new SSL certificate.

  4. Test Automatic Renewal: Let’s Encrypt certificates are valid for 90 days. Test automatic renewal with:
    sudo certbot renew --dry-run

Step 4: Update WordPress Settings

After installing your SSL certificate:

  1. Log in to WordPress as an administrator.
  2. Go to Settings > General.
  3. Update your WordPress Address (URL) and Site Address (URL) to use https instead of http.
  4. Save the changes.

Step 5: Force HTTPS Redirection

You might need to enforce HTTPS by editing your .htaccess file:

  1. Access your site’s root directory and locate the .htaccess file.
  2. Add the following at the top of the file:
    <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule>
  3. Save the file.

Step 6: Fix Mixed Content Issues

Sometimes, your site may still serve some content (like images or scripts) over HTTP. To fix this:

  1. Use a plugin like Really Simple SSL to automatically detect and fix mixed content issues.
  2. Activate the plugin and let it configure your site.

Following these steps should help you securely set up HTTPS on your WordPress site using Let’s Encrypt. If you run into any issues, consider reaching out to your hosting provider’s support or a professional web developer.