We're rather pleased to announce our second plugin for the famed Wordpress semantic publishing system. It's called Force SSL, and it's a handy little thing. For those will an SSL certificate, this plugin forces an HTTPS connection for security purposes.
Perhaps you're interested in the PHP scripting technique that makes all of this possible? Maybe you don't feel like taking a look at the source code, and you'd like a little help right quick?
Force SSL simply redirects requests made via regular old http to requests for trusty new https, and that's about it. Here's the PHP code that makes this possible, with some small changes to allow it to run from outside of Wordpress:
if($_SERVER["HTTPS"] != "on") {
$newurl = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
header("Location: $newurl");
exit();
}
One could, if one wanted, place this snippet in their header and find that a user wouldn't be able to, say, remove the s from their browser address. That would mean that your content would only be available via an SSL connection - provided that you actually have an SSL certificate and whatnot.





[...] Force SSL è un plugin che effettua un redirect al protocollo HTTPS invece di usare connessioni HTTP. Idea interessante per coloro che necessitano di maggiore sicurezza e dispongono di un certificato SSL. [...]