Need help setting up recaptcha v2 on Apache server using htaccess

Melody Scott
Melody Scott used Ask the Experts™
We use a company called my contact form for our forms onsite.

But they use a standard captcha where you have to enter text, and we have an older base, who have trouble with it, so we'd like to replace it with a recaptcha.

I've got the client side on that page, but I have no idea how to implement the server-side, I'm hoping someone can tell me how to so it with htaccess.

Google says:
When your users submit the form where you integrated reCAPTCHA, you'll get as part of the payload a string with the name "g-recaptcha-response". In order to check whether Google has verified that user, send a POST request with these parameters:
secret (required)      6LdfIn4UAAAAALJ-198KrFzDKKytHk5w9tTipp8m
response (required)      The value of 'g-recaptcha-response'.
remoteip      The end user's ip address.

The reCAPTCHA documentation site describes more details and advanced configurations.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fractional CTO
Distinguished Expert 2018
1) Use Recaptcha v3 for far more flexibility.

2) You're running custom code (no CMS) on your server side, so whoever does your server side work will be person you have do this work.

What you do server side, might be simple or complex. The more pages you inject the Recaptcha into, the more context Google has to determine if the visitor is human or bot, then what to do if anything...

So for humans, they won't see any message at all.

3) There is no .htaccess way to inject Recaptcha as this must be injected into actual HTML of each page.
David FavorFractional CTO
Distinguished Expert 2018

Commented: provides a quick overview of how Recaptcha v3 works.


Thanks, David, I try to never ask the server guy because he's so busy, but now I know. :) I'll check out the video.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial