Force SSL Plugin

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.

Click here for the plugin »

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.

Advertisement

22 Responses to “Force SSL Plugin”


  1. 1 Thomas October 26, 2006 at 3:31 pm

    Hello,

    I was trying your plugin Force SSL with no luck. I like to have only one page inside wordpress secure for a checkout. The problem is IE as it gives me the message "Do you want to display the non secure items as well".

    Is there any way to avoid that? When I look into it than I see that the image files for the header and footer loaded from http even the page is https.

    Thomas

  2. 2 Trevor October 26, 2006 at 4:18 pm

    I would prefer that you keep support questions in the forum. I hate it when people try to support plugins in their blog comments, because you can't keep track of anything that way.

    However, this problem is a very and common one! You should check your page more closely to make sure that there are no images being called up without "https".

    In your case, I'm seeing a lot of images being called up with non-ssl Amazon.com stuff. I'd start by double-checking that, and then diving deeper into your source code. As far as I know, using non-ssl stuff like images (any maybe css? i'm not sure.) on your page is the only possible source of this problem.

    Good luck, sir!

  3. 3 Scott Kingsley Clark January 7, 2009 at 4:36 am

    I suggest that the opening statement in the function be:

    if(!isset($_SERVER["HTTPS"])||$_SERVER["HTTPS"]!="on")

    instead of:

    if($_SERVER["HTTPS"]!="on")

    so as to not pull errors (in error reporting) if it's not set (in some configurations it won't set this if it's not in SSL mode).

  4. 4 Scott Kingsley Clark January 7, 2009 at 4:36 am

    I also suggest that you list your plugin within WordPress's Plugin site to maximize your exposure.

  5. 5 dan November 19, 2009 at 5:54 am

    thank you this worked as soon as I installed it. I was hesitant at first after reading all the comments, but it worked great.

  6. 6 Martin December 2, 2009 at 4:54 am

    Is there any set-up to do somewhere in the WPMU Admin to enable your "Force SSL" plugin?

  7. 7 Paul December 22, 2009 at 8:18 am

    I think I might have stumbled across a potential solution – I've used the "force-ssl" plugin with "HTTPS for WordPress" plugin and it seems to avoid the Force SSL looping redirect issues. Not sure why…but will see how it goes

  8. 8 yo February 9, 2010 at 3:56 am

    I installed the plugin and the web I have stopped working. Now it gives me connection error. How can I fix it? I uninstall the plugin?

  9. 9 John May 4, 2010 at 10:48 pm

    I've installed force SSL and now I get the error:

    ssl_error_rx_record_too_long

    I can't even delete the plugin through ftp to disable it.

    Any ideas?

  10. 10 hüseyin September 1, 2011 at 4:31 pm

    ssl_error_rx_record_too_long

    i have error dont entry web page help me


  1. 1 WordPress Italy » Blog Archive » Plugin WordPress: Force SSL Trackback on November 5, 2005 at 3:16 am
  2. 2 Wordpress???????Plugin ???10 | ???????????WP Trackback on November 7, 2009 at 5:20 pm
  3. 3 10 Wordpress Security Plugins | Dustin Ward Trackback on November 10, 2009 at 5:11 pm
  4. 4 Subinet Trackback on November 20, 2009 at 9:05 am
  5. 5 WordPress: 10 plugins para aumentar la seguridad de tu sitio - elWebmaster.com Trackback on November 27, 2009 at 4:00 am
  6. 6 WwW.UrbaNicaNo.Net || Tu Web De Reggaetón & Eventos Urbanos » WordPress: 10 plugins para aumentar la seguridad de tu sitio Trackback on December 4, 2009 at 9:24 am
  7. 7 WordPress: 10 plugins para aumentar la seguridad de tu sitio « Historial de un navegante Trackback on December 7, 2009 at 12:02 pm
  8. 8 Sembilan Security Plugin untuk Wordpress Anda Trackback on December 11, 2009 at 12:17 pm
  9. 9 Top 10 Wordpress Security Plugins | Trackback on December 15, 2009 at 7:18 am
  10. 10 Top 10 Best Security Plugins for Wordpress Trackback on March 3, 2010 at 2:49 am
  11. 11 Plugins para asegurar Wordpress Trackback on May 2, 2010 at 5:27 pm
  12. 12 The Best Security Plugins for WordPress Trackback on September 3, 2010 at 2:41 pm
Comments are currently closed.




Follow

Get every new post delivered to your Inbox.