Knowledge Base

How to Add Google reCAPTCHA to Your Website on plesk

Step 1: Generate reCAPTCHA API Keys

  1. Go to https://www.google.com/recaptcha/admin/create
  2. Log in with your Google account.

  3. Under “Label”, enter a name for your site (for example: thamara.cloud-site).

  4. Under “reCAPTCHA type”, choose “reCAPTCHA v2 → I’m not a robot Checkbox”.

  5. In the “Domains” field, enter your website domain (for example: example.com).

  6. Accept the reCAPTCHA Terms of Service.

  7. Click “Submit”.

  8. Copy your Site Key and Secret Key. You’ll need both for setup.


Step 2: Add reCAPTCHA Code to Your Website in Plesk

  1. Log in to your Thamara.Cloud Plesk Panel.

  2. Go to Websites & Domains → File Manager.

  3. Open your website’s root directory (usually httpdocs/).

  4. Find the page that contains your form (for example: contact.html or login.php).

Add the reCAPTCHA widget above your form’s submit button.

Replace YOUR_SITE_KEY with the Site Key you copied from Google.

Add the reCAPTCHA script before the closing body tag.

 

Example form:



Step 3: Save and Test

  1. Click Save in File Manager.

  2. Visit your site and refresh the page.

  3. You should see the “I’m not a robot” checkbox below your form.

  4. Submit a test form to confirm it works.


Optional: Backend Verification (for PHP sites)

$recaptcha = $_POST['g-recaptcha-response'];
$secret = 'YOUR_SECRET_KEY';
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$recaptcha");

secret=$secret&response=$recaptcha

if ($result['success']) {
// Passed
} else {
// Failed
}


Tip from Thamara.Cloud:
If your site uses WordPress, you can skip manual coding. Install a plugin like WPForms or Contact Form 7, and paste your reCAPTCHA keys directly into the plugin settings.

Please rate this article to help us improve our Knowledge Base.

0 0