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:
- Log in to your hosting control panel.
- Look for the Security section or a dedicated section for SSL/TLS management.
- Select Let’s Encrypt or a similar SSL option.
- 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:
- SSH Access: Log in to your server via SSH.
- 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.)
- 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. - 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:
- Log in to WordPress as an administrator.
- Go to Settings > General.
- Update your WordPress Address (URL) and Site Address (URL) to use
https
instead ofhttp
. - Save the changes.
Step 5: Force HTTPS Redirection
You might need to enforce HTTPS by editing your .htaccess
file:
- Access your site’s root directory and locate the
.htaccess
file. - 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>
- 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:
- Use a plugin like Really Simple SSL to automatically detect and fix mixed content issues.
- 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.