Https to http redirect using htaccess

Attempt 2 was close to perfect. Just modify it slightly: RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] UPDATE: Above solution works from a technical point of view. BUT: Since a few years now the user will receive a huge warning indicating that the connection is not private. That is to be expected: none … Read more

How to Include CSS and JS files via HTTPS when needed?

Use protocol-relative paths. Thus not <link rel=”stylesheet” href=”http://example.com/style.css”> <script src=”http://example.com/script.js”></script> but so <link rel=”stylesheet” href=”https://example.com/style.css”> <script src=”https://example.com/script.js”></script> then it will use the protocol of the parent page.

SSL Certificate add failed when binding to port

I had the same error. The first time it occurred, as Micheal said, I had to move the certificate under Certificates(Local Computer) –>Personal –>Certificate folder. I had the same error when I imported the same certificate on another machine. The reason was that I was using certmgr.msc to import the certificate. . The window opened … Read more

How to create self signed SSL certificate for test purposes? [closed]

You can do this via openssl: Install openssl package (if you are using Windows, download binaries here). Generate private key: openssl genrsa 2048 > private.pem Generate the self signed certificate: openssl req -x509 -days 1000 -new -key private.pem -out public.pem If needed, create PFX: openssl pkcs12 -export -in public.pem -inkey private.pem -out mycert.pfx

Ideal HTTP cache control headers for different types of resources

I would probably use these settings: Cache-Control: max-age=31556926 – Representations may be cached by any cache. The cached representation is to be considered fresh for 1 year: To mark a response as “never expires,” an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT … Read more

PHP CURL & HTTPS

Quick fix, add this in your options: curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false) Now you have no idea what host you’re actually connecting to, because cURL will not verify the certificate in any way. Hope you enjoy man-in-the-middle attacks! Or just add it to your current function: /** * Get a web file (HTML, XHTML, XML, image, etc.) from … Read more