El Dorado

A full-stack community web application written in Ruby/Rails
Force SSL Plugin « Wordpress « almost effortless
 
Thu, 03 Nov 2005, 9:04pm #1
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

For those will an SSL certificate, the Force SSL plugin forces an HTTPS connection for security purposes. This is useful for those who with to enforce a higher level of security regarding the delivery of Wordpress content to the browser.

This plugin works by redirecting any requests for pages via plain old http into requests for pages via https. This means that someone can’t just remove the “s” from “https” and get their content from outside of a secure SSL connection. It’s that simple.


http://www.almosteffortless.com/wordpress/force...

Offline
Wed, 23 Aug 2006, 6:27pm #2
jowens
New member
Registered: Aug, 2006
Last visit: Wed, 23 Aug 2006
Posts: 1

Are there plans to release a version of this plugin that works with Wordpress 2.x? I'd be a very happy man if there were!

Offline
Thu, 24 Aug 2006, 1:29pm #3
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

jowens, this plugin works just fine with 2.x as far as I know. I'm using it myself.

Offline
Thu, 23 Nov 2006, 3:53am #4
sac
New member
Registered: Nov, 2006
Last visit: Sun, 10 Dec 2006
Posts: 5

I would like to have only a couple of pages in my wordpress blog secure for contact forms but I don't know how. Do I have to modify the code?

Offline
Fri, 24 Nov 2006, 12:38am #5
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

You could add some conditional tags around the plugin, so the whole thing is surrounded by and IF checking for a particular page (or pages). You can see what I mean here on the Codex: http://codex.wordpress.org/Conditional_Tags

Offline
Tue, 05 Dec 2006, 7:46pm #6
sac
New member
Registered: Nov, 2006
Last visit: Sun, 10 Dec 2006
Posts: 5

I tried but got an error.

"Parse error: syntax error, unexpected $end in ---(path) force-ssl.php on line 40. "

I added

if (is_page('22'))
{

before

function force_ssl() {

and

}

after

add_action('plugins_loaded', 'force_ssl');
2?>

Is something wrong? 22 is the ID of the page. I tried to use the title of the page as well but got the same error.

Offline
Tue, 05 Dec 2006, 9:59pm #7
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

you want to wrap the if statement just around the force_ssl function. so, just move your closing } thingy up above the add_actions thing there.

Offline
Wed, 06 Dec 2006, 1:50am #8
sac
New member
Registered: Nov, 2006
Last visit: Sun, 10 Dec 2006
Posts: 5

I moved the } but now it doesn't secure any pages at all.. Also, when I get in admin (edit) mode, I get this error.

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'force_ssl' was given in /home/--path--/wp-includes/functions.php on line 1329

Warning: Cannot modify header information - headers already sent by (output started at /home/--path--/wp-includes/functions.php:1329) in /home/--path--/wp-admin/inline-uploading.php on line 5

Warning: Cannot modify header information - headers already sent by (output started at /home/--path--/wp-includes/functions.php:1329) in /home/--path--/wp-includes/pluggable-functions.php on line 269

Offline
Wed, 06 Dec 2006, 5:39pm #9
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

You must have some white-space issues going on. PHP will complain if you have blank lines anywhere, so you could try that.

Offline
Fri, 08 Dec 2006, 1:13am #10
sac
New member
Registered: Nov, 2006
Last visit: Sun, 10 Dec 2006
Posts: 5

I don't see any blank lines in the plugin..

Offline
Fri, 08 Dec 2006, 10:01am #11
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

Why don't you upload the file to your site with a phps extension, and I can have a look.

Offline
Sat, 09 Dec 2006, 8:30pm #12
sac
New member
Registered: Nov, 2006
Last visit: Sun, 10 Dec 2006
Posts: 5

I sent you an email. Thanks.

Offline
Sat, 21 Apr 2007, 7:15am #13
oolong
New member
Registered: Apr, 2007
Last visit: Wed, 25 Apr 2007
Posts: 1

Nice plugin! thanks!


~/oolong tea/ wu-long~~

Offline
Thu, 26 Apr 2007, 3:42pm #14
viperteq
New member
Registered: Apr, 2007
Last visit: Thu, 26 Apr 2007
Posts: 1

I get how to install the plugin into WordPress. My question is how do you set up the SSL cert so that the plugin see it and handles the re-direct as it's supposed to? More instruction in this area would be helpful.

Offline
Tue, 08 May 2007, 1:08pm #15
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

viperteq, you'll have to buy your own SSL certificate. I think there are tons of different ways to do it - and I don't know what the best way is. You could try here to begin with: https://www.godaddy.com/gdshop/ssl/ssl.asp

Once you have your SSL certificate, then your https:// connection will work without any other configurations.

Offline
Thu, 24 May 2007, 1:32pm #16
johnnyspade
New member
Registered: May, 2007
Last visit: Thu, 24 May 2007
Posts: 1

Trevor wrote:

Why don't you upload the file to your site with a phps extension, and I can have a look.

Trevor, this is a great plugin, thanks for sharing it.

I have the same need as sac, wanting to secure only select pages. Would you mind posting the solution for this, if there was one?

Cheers,
Brandon

Offline
Thu, 24 May 2007, 2:06pm #17
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

I think this will work, but it's not tested at all. If you get some errors, please reply to this topic and we'll figure out how to fix it.

You'll need to manually set the page ids you want to force ssl on in the plugin:

http://pastie.caboo.se/64324

Offline
Thu, 26 Jun 2008, 12:45pm #18
bluetrain
New member
Registered: Jun, 2008
Last visit: Thu, 26 Jun 2008
Posts: 1

Hi Trevor,
I tried the code from http://pastie.caboo.se/64324 as I also would like to force SSL for only a couple form pages, it did not work. Your original plugin code does work with WP2.5.1 but when I added the modified code version it didn't work.

Was there ever any follow-up on this discussion from 2007? Was new code ever created that worked?

Offline
Thu, 26 Jun 2008, 12:48pm #19
Trevor
Administrator
Wait-ill-fix-it
Registered: Sep, 2005
Last visit: 5 hours ago
Posts: 240

Not that I know of, sorry. You might have better luck on the WordPress forums here:

http://wordpress.org/support/

Offline