Even today, most website providers are making all their customers’ websites HTTPS-compliant by default. So if you’re still running your Drupal websites or blogs not using HTTPS, then you’re probably doing it wrong. This brief tutorial is going to show students and new users how to convert existing Drupal websites from HTTP to HTTPS easily without losing your audience. When you’re done, all traffic to your sites will be redirected to the HTTPS version of your content. To get started with migrating your Drupal sites to HTTPS, continue with the steps below:
Setup Let’s Encrypt Free SSL / TLS
The first step going all HTTPS is obtaining SSL/TLS certificates for your domain or site. Since Let’s Encrypt is free, continue below to obtain your free certificates to use. Before obtaining Let’s Encrypt certificates, make sure your Apache2 configuration is set up correctly. for your site config file, make sure the ServerName and ServerAlias are defined. When those settings are confirmed, continue below to get the certificate for your domain name. To get the Let’s Encrypt SSL/TLS client installed on Ubuntu, run the commands below After that run the commands below to obtain your free Let’s Encrypt SSL/TLS certificate for your site. After running the above commands, you should get prompted to accept the licensing terms. If everything is checked, the client should automatically install the free SSL/TLS certificate and configure the Nginx site to use the certs. Choose Yes ( Y ) to share your email address This is how easy is it to obtain your free SSL/TLS certificate for your Nginx-powered website. Pick option 2 to redirect all traffic over HTTPS. This is important! After that, the SSL client should install the cert and configure your website to redirect all traffic over HTTPS. The highlighted code block should be added to your Apache2 Drupal configuration file automatically by Let’s Encrypt certbot. Your Drupal site is ready to be used over HTTPS. A new configuration file for the domain should also be created named /etc/apache2/sites-available/example-le-ssl.conf. This is an Apache2 SSL module configuration file and should contain the certificate definitions defined in it.
Change Drupal Site URL
After configuring Apache2 to use HTTPS above, change Drupal site URL to use HTTPS. this can be done by editing settings.php file in your Drupal root directory. sudo nano /var/www/html/example.com/sites/default/settings.php Open the Drupal settings.php file in your Drupal root directory and add the lines below: Save the file Now you should be able to log on to the Drupal admin dashboard via HTTPS.
Install Secure Login Plugin
Finally, login to the Drupal dashboard and install the Secure Login plugin to redirect all HTTP references to HTTPS After installing and activating the plugin, go to Configuration –> Secure Login. then check the box to redirect all pages to the secure URL. including all forms This should do it. After that, your site should be HTTPS compliant. Congratulations! You’ve successfully converted from HTTP to HTTPS To set up a process to automatically renew the certificates, add a cron job to execute the renewal process. Then add the line below and save. The cron job will attempt to renew 30 days before expiring You may also like the post below: