So in the past I have always bought a new IP when working with SSL certs. I came across a client that is on a shared IP and using a cert for one of the sites but not the others. So domain #1 has cert on it, and Domain #2 doesn't.

Domain #2 has things in Google indexed with HTTPS on them. I need to block HTTPS on domain #2 as it shouldn't be using it and I don't want HTTPS versions of pages appearing in Google's index.

How can I go about doing this without purchasing another IP? Is dropping the below code into my .htaccess file a good approach?

Options +FollowSymlinks
RewriteEngine on
RewriteBase /

RewriteCond %{SERVER_PORT} ^443$ [OR]

RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
  • See here. Do it at the Server Level instead as Shared IP usually denotes Virtual Hosting – eyoung100 Sep 11 '14 at 16:15

That approach should work fine so long as your Apache config is setup so your application is listening on both ports 80 and 443

However, the original requests will show a warning about not have a valid SSL certificate. See the answer E Carter Young linked to in his comment if you need to avoid that.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.