Jump to content
Sign in to follow this  
tork

google recaptcha V2 on apache shared server: How to get it to work with SSL

Recommended Posts

I implemented google's reCAPTCHA V2 on http:// on the remote apache shared server and it worked 100%. I then changed the protocol to my shared server SSL using the same PHP script as the non-SSL script. The older version of reCaptcha had an SSL 'false' to 'true' SSL parameter, whereas I can't find one for V2. I had to use htaccess to redirect the example.com to the shared SSL server https://serverid.net/example/ which works perfectly without recCAPTCHA. I incorporated reCAPTCHA V2 and the error message where the reCAPTCHA image should be shows "ERROR: Invalid domain for site key".
 
Here's the htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://servername.net/example/$1 [R,L]

And the recaptchalib.php code in case that helps:

https://github.com/google/ReCAPTCHA/blob/master/php/recaptchalib.php

 
Anyone know how to make this work?

 

(If this is not the right forum for this, please direct me to the appropriate one. Thx)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.