1

I have a url that is used to store data across multiple sites based on client ID. Many of our clients are now wanting to use secure https resolution, yet the data referenced on their sites from this specific url is not currently secure, therefore I'm getting an error that "some parts of this page are not secure (such as images)", and I'm looking for a rewrite condition that would enable forwarding of the storage location url to https if it's being referenced from an https site only, yet still allows http resolution of the same storage url if not.

Any assistance on this topic would be greatly appreciated. Thanks in advance to all contributors. David W.

David W.
  • 11
  • 1
  • If the only thing changing on the url is http vs https, I *think* all the current browsers now support references like `` where the protocol to use is assumed to be the protocol of the main page. – ivanivan Jun 22 '18 at 01:51

1 Answers1

0

Put this in your Apache config

RewriteCond %{HTTP_REFERER} ^https://
RewriteCond %{HTTPS} !=on # This checks to make sure the connection is not already HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
Gerard H. Pille
  • 2,469
  • 1
  • 12
  • 10