1

I'm trying to make it so that ALL pages are served over SSL and have a https:// prefix.

I'm using the latest Drupal (as of 16.2.15) and running Apache (Fast CGI)

I'd really like it so that if a visitor were to type in:

http://example.com/test1
http://example.com/test2

they's end up at:

https://example.com/test1
https://example.com/test2

With the https added in automatically.

As per this question: How to simply make the whole site HTTPS?

I've added this at the very end of the D7 .htaccess in the root of the domain:

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This is not surrounded by any exceptions.

This seems to enforce SSL, but all pages with http:// get redirected to /index.php

So if I got to:

http://example.com/test1

I end up at:

https://example.com/index.php

NOT

https://example.com/test1

as I'd hoped!

Thanks for any help!

  • 3
    Put that as your first rule, not last – Clive Feb 16 '15 at 14:54
  • Genius - that appears to do the trick! Thanks so much! How do I credit you as the correct answer? – njwrigley Feb 16 '15 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.