I have a multisite setup with drupal 7.23 which is working fine. Websites are like this:


  • http:// www.site1.info

SITE2 and 2 subdomains

  • https:// www.site2.com
  • https:// sub1.site2.com
  • https:// sub2.site2.com


  • https:// www.site3.com

As you can see site2 and site3 are full SSL anabled but for site1 I have only some pages with SSL like this:


  • http:// www.site1.info
  • http:// www.site1.info/page1


  • https:// www.site1.info/page2
  • https:// www.site1.info/page2/subpage1

I have enabled non www. to www. redirect which drupal is offering by default and adjusted it a bit:

RewriteEngine on

  # I've also added these 2 lines to redirect HTTP to HTTPS because the next 3 lines didn't worked.
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  RewriteRule ^ - [E=protossl]
  RewriteCond %{HTTPS} on
  RewriteRule ^ - [E=protossl:s]

  RewriteCond %{HTTP_HOST} .
  RewriteCond %{HTTP_HOST} !^(www|sub1|sub2)\. [NC]
  RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

BUT here is where I'm stuck: if I access for instance: https://www.site1.info it s not redirected to http://www.site1.info and keep SSL ony for the desired pages. I'm not sure how to write all these rewrite rules given the fact that I'm no htaccess expert.

closed as off-topic by Free Radical, Shawn Conn, mradcliffe, leymannx, kiamlaluno Aug 4 '18 at 20:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – Free Radical, Shawn Conn, mradcliffe, leymannx
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please don't use code blocks for things that are not code. And by the way, I don't quite understand your needs, but go have a look on Secure Pages module. – Mołot Oct 17 '13 at 12:14
  • Ok, perhaps I should explain better situation for site1. As I said only some of the pages need ssl, not the whole site. So i only need to redirect those pages and not all website but also not interfere with site2 and site3. I was thinking this could be done in .htaccess without installing an extra module. – de0 Oct 17 '13 at 12:25
  • @tenken look at the revision history of the question. See the revision that was in place when I posted my comment. Then you will see I was not talking about Apache conf. – Mołot Oct 17 '13 at 15:13
  • I would tell you to check out the htaccess module but they don't have multisite options. These are the only options: ![enter image description here](i.stack.imgur.com/yK7X8.png) – Dan Mantyla Aug 24 '17 at 21:56
  • 1
    Apache rewrites has little to do with Drupal. You should ask this on serverfault.com – Free Radical Aug 4 '18 at 10:26