Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HTTP to HTTPS redirects for Drupal Multisite Setup

Discussion in 'Security' started by ProUser, Aug 2, 2017.

Tags:
  1. ProUser

    ProUser Registered

    Joined:
    Jan 15, 2015
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    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?
     
  2. Tearabite

    Tearabite Active Member

    Joined:
    Nov 28, 2010
    Messages:
    28
    Likes Received:
    2
    Trophy Points:
    53
    Location:
    Southern California
    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.
     
  3. fuzzylogic

    fuzzylogic Well-Known Member

    Joined:
    Nov 8, 2014
    Messages:
    52
    Likes Received:
    23
    Trophy Points:
    8
    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>
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. ProUser

    ProUser Registered

    Joined:
    Jan 15, 2015
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    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.
     
    Infopro likes this.
Loading...

Share This Page