2

I have several sites on one server but one the urls needs to be https.

for examples sake: http://www.example1.com/ https://www.example2.com/

i've been using htaccess to force https but it does it to ALL the urls essentially breaking all except that one URL i have a SSL cert for.

how can i force https on that one site?

BenMorel
  • 34,448
  • 50
  • 182
  • 322

1 Answers1

1

You can use a double-condition in your htaccess:
- condition 1: check for www.example2.com only
- condition 2: check for http requests only

RewriteCond %{HTTP_HOST} ^www\.example2\.com$ [NC]
RewriteCond %{HTTPS} =off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

This way, every http url from www.example2.com will go to https equivalent

Justin Iurman
  • 18,954
  • 3
  • 35
  • 54