How to enable SSL use in Drupal

Overview on how to configure your Drupal website with SSL

This tutorial will review the process of setting SSL on your Drupal installation. This will secure payment transactions on your website (if any) and make it look more professional in your clients’ eyes.


Step 1 Get an SSL certificate

The first thing is to make sure that you have a valid SSL certificate on your domain name. This will ensure that you can proceed further with the actual configuration of the SSL on your website. To get an SSL certificate on your domain, you first need to purchase it via your Client Area > Orders. The installation is handled by our technical support team and you do not have to make changes on your end.


Step 2 Force SSL use

Drupal automatically detects if you have an SSL installed on your domain. Thus, you will be able to access your website with both the http and the secured https protocol. However, if you would like to force an SSL redirection each time someone is trying to access your website, such a redirect should be configured within the .htaccess file of your website.


To achieve that, you need to log into your cPanel account. Locate the File section and click on the File Manager service.


Access File Manager via cPanel


You will see a pop-up window. You need to enable the Home Directory and Show Hidden Files (dotfiles) options.


File Manager options in cPanel


Then you need to navigate to the location of your Drupal installation. In our case, this is located within the public_html/ directory and then a folder called drupal. When you access the folder of your Drupal website, simply select the .htaccess file and click on the Edit button at the top menu.


Edit a file via File Manager in cPanel


Find the line that says:


RewriteEngine on


When you do, simply enter the following code below that line:


RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ [R,L]


where you need to change to your actual domain name. The outcome of this change will look like like the following.


# Various rewrite rules.
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{SERVER_PORT} 80
 RewriteRule ^(.*)$ [R,L]


When you are ready with the changes, simply click on the Save Changes button at the top-right corner of the screen.