HTTP to HTTPS redirects for Drupal Multisite Setup

ProUser

Registered
Jan 15, 2015
2
1
3
cPanel Access Level
Root Administrator
Hi,

I have a Drupal 7 multisite installation in a cPanel account, currently serving 3 domains. I have SSL certificates installed and working. However I need to ensure that all HTTP traffic is redirected to HTTPS for all domains.
Since Drupal use a single .htaccess file, I'm struggling with how to configure it correctly.

So, this is what I want to accomplish:
Code:
http://domain1.com to be redirected to https://domain1.com
http://www.domain1.com to be redirected to https://www.domain1.com
http://domain2.com to be redirected to https://domain2.com
http://www.domain2.com to be redirected to https://www.domain2.com
http://domain3.com to be redirected to https://domain3.com
http://www.domain3.com to be redirected to https://www.domain3.com
Any suggestions?
 

fuzzylogic

Well-Known Member
Nov 8, 2014
154
95
78
cPanel Access Level
Root Administrator
You could try...
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
or
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
 

ProUser

Registered
Jan 15, 2015
2
1
3
cPanel Access Level
Root Administrator
Have you tried using a Drupal module to do this? I use Secure Pages and it does the job - but I'm not in a multisite setup.
It might be a solution, however the Secure pages module is not something I would use in a production environment. The latest version is a beta 2 from November 2013. The issue queue, well... Also this module is not covered by Drupal’s security advisory policy.
 
  • Like
Reactions: Infopro