How To Install SSL Certificate on Drupal?
In this article, we will explore the step-by-step procedure to – “Install an SSL certificate on Drupal.” Drupal is a free, flexible, multilingual, and open-source CMS that can be customized and is ideal for constructing simple websites or complex online apps.
To install the SSL certificate on Drupal, you first need an SSL certificate, and to acquire one, you must submit a Certificate Signing Request to a trusted CA.
If you don’t know how to generate a CSR, read the subsequent section mentioned below, and if you already have an SSL cert for Drupal issued by the CA, move on to the installation steps.
How to Generate a Code Signing Request (CSR)?
CSR is an encoded text block containing information about your company or website’s identity, which the CA must verify before signing your certificate. It is important to remember that all the information you provide in the CSR should be the latest and correct, or else the CA may reject your certificate signing request.
There are two ways to generate the CSR:
- Use a CSR Generator tool to generate CSR automatically.
- Do it manually
Once you have generated the CSR, send it to a trusted Certificate Authority. The duration for certificate files to reach you may differ depending on the type of validation you have selected.
After the CA verifies that the details mentioned in the CSR are accurate, it will send your SSL (Secure Sockets Layer) certificate and additional files necessary for installation to your registered email address in a .zip folder.
After getting the email, download and extract all the files from the .zip folder onto your local machine. Make sure that you have all of these three files:
- Main Certificate File (.crt file)
- Root and intermediate certificates (.ca-bundle file)
- Private Key File
How to Install an SSL Certificate on Drupal?
Follow the steps mentioned below to install the SSL cert on Drupal:
- Log in to your account using SSH.
- Open the .htaccess file in the Drupal directory. (Use a command-line text editor to do so.)
- Copy the code given below and paste it into the .htaccess file
RewritreCond%{HTTPS} off
RewriteRule^(.)$https://%{HTTPS_HOST}%{REQUEST_URL}[L,R=301]
RewriteCond%{HTTPS_HOST} !^www. RewriteRule^(.)$https://www.%{HTTPS_HOST}%{REQUEST_URL}[L,R=301]
4. Save the file.
Test the Installation
Follow the steps mentioned below to test the SSL certificate installation status:
- Exit from the File Manager.
- Log out from your web hosting cPanel.
- Login to Drupal’s admin page.
- From the admin toolbar, navigate to Select Site > Global Configuration > System.
- Click YES beside the “use Apache mod rewrite” option.
- Click Save.
- Open the Drupal website in the browser.
- The below-mentioned event should happen:
- Users typing sslexample.com or www.sslexample.com will be redirected to – https://www.sslexample.com. (They will always be redirected to the HTTPS version of the website.)
It is highly recommended that the installation status of the certificate be checked or tested. To do so, use SSL testing tools (SSL Labs, SSL Checker, etc.) as they can instantly identify any vulnerabilities or potential errors, if present, and provide a detailed report about the same.