How to enable SSL use in Drupal

Updated on Nov 22, 2017

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.

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.

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 ^(.*)$ https://www.example.com/ [R,L]

where you need to change example.com 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 ^(.*)$ https://www.example.com/ [R,L]

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

On this page...

    Drupal Hosting

    • Free Drupal Installation
    • 24/7 Drupal Support
    • Free Domain Transfer
    • Hack-free Protection
    • Fast SSD Storage
    • Free Drupal Transfer
    • Free CloudFlare CDN
    • Immediate Activation
    View More