inside the mind of a linux admin

how to force SSL without .htaccess redirects

There are instances where a full htaccess redirect rule is not the best solution, specifically to enforce only a single page to be encrypted. This may occur during PCI compliance scans which report an insecure login page. In this example, simply adding the following code to the header of the SSL-desired page will force it to revert to a secure connection:

(paste inside PHP brackets)


$secure_url = sprintf("%s%s%s","https://",$HTTP_HOST,$REQUEST_URI);
// do nothing
} else {
Header("Location: $secure_url");

Related Posts

synergy: How to enable crypto (encryption) and generate SSL certificate

The newer Linux versions of the popular mouse/keyboard sharing application “synergy” now has built in encryption. Here’s how to configure it: Just simply passing the –enable-crypto flag on your synergy server without having a proper SSL certificate will result in the inability to connect to clients and generate an error message similar to this in […]

Read More

Change Number Pad Delete (dot) key from a comma in Ubuntu Linux

I recently purchased a new keyboard and updated to the latest Ubuntu, I’m also an avid user of the number pad for quick input when dealing with spreadsheets or accounting. I found that my num pad’s delete key (“.”) was outputting a comma (“,”) instead. Pretty annoying? I agree, but this can be very easily […]

Read More


  • Luffie on Monday, February 22, 2010

    At work the man I worked with got a virus opening a picture and when I am not there he tends to use my computer because its faster, I have important information about payrolls and financial info about the company and I can’t afford to lose it. Thanks santoramaa

  • Ruben Boldon on Wednesday, February 24, 2010

    Thanks for writing about this. There’s a bunch of good tech info on the internet. You’ve got a lot of that info here on your site. I’m impressed – I try to keep a couple blogs fairly up-to-date, but it’s a struggle sometimes. You’ve done a great job with this one. How do you do it?

  • Coupon Script on Friday, March 12, 2010

    Could you go into more detail on this? Btw, the advice you gave me is really good.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.