Check 47.03 · Practices to avoid

Eliminate deceptive cloaking

Detect and remove cloaking: content or redirects that change by crawler, referrer or IP, on Apache, Nginx, Cloudflare, AWS, WordPress or Next.js.

Priority
Critical
Difficulty
Advanced
Estimated time
2 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Cloaking means serving search engines different content from what visitors see, in order to manipulate rankings. It works by reading the request's user agent, IP address or referrer. Google lists it among the most serious spam practices. This check consists in making sure that no rule in the server, the CDN, the CMS or the application treats crawlers separately, and removing those that do. Expected result: for the same URL, Googlebot, Bingbot, AI crawlers and a visitor receive the same main content.

Why it matters

Google's spam policies define cloaking as presenting different content to users and search engines with the intent to manipulate search rankings and mislead users. Two examples are given: a page about travel destinations shown to search engines and a page about discount drugs shown to users, or keywords inserted only when the requester is a search engine. Sneaky redirects, which send the visitor somewhere other than the page the crawler saw, are treated the same way.

The consequences range from demotion to the “Cloaking and/or sneaky redirects” manual action, or even “Major spam problems” when cloaking is combined with other abuse. Cloaking is not always intentional: a hacked site often serves it so that its owner sees nothing, showing the spam only to crawlers or to visitors coming from Google.

For generative engines, the stakes are the same: an assistant that summarizes or cites a page must describe what the visitor will find on clicking. Serving AI crawlers a special version falls under the check eliminate misleading content aimed at bots (opens in a new tab).

What it improves

  • Compliance Removes one of the heaviest causes of manual action.
  • Security Looking for conditional rules often reveals a hack.
  • Reliable indexing What Google indexes and displays matches what the visitor finds.
  • Consistent AI citations Assistants describe the real page. No guarantee of citation.
  • Maintenance A single version of each page to test and evolve.

How to check

1. Compare responses by user agent. This script saves the page as seen by a browser, by Googlebot, by Bingbot and by an AI crawler, then shows the HTTP code, size, final URL and title:

URL="https://example.com/"
test_ua() {
  curl -s -L -A "$2" -o "$1.html" -w "$1 : %{http_code} %{size_download} bytes %{url_effective}\n" "$URL"
  grep -o -i '<title>[^<]*' "$1.html"
}
test_ua navigateur "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Safari/537.36"
test_ua googlebot "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
test_ua bingbot "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
test_ua gptbot "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.1; +https://openai.com/gptbot)"
diff <(sed 's/<[^>]*>//g' navigateur.html | tr -s ' \n') <(sed 's/<[^>]*>//g' googlebot.html | tr -s ' \n') | head -40

Acceptable small differences: security tokens, timestamps, ad blocks. Alarming differences: a different title, paragraphs or links present on one side only, a different final URL.

2. Compare by referrer. Some hacks only redirect visitors coming from a search engine:

curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" https://example.com/
curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" -e "https://www.google.com/" https://example.com/

Both lines must be identical. Run the test again with a smartphone user agent: sneaky redirects often target mobile.

3. See what the real Googlebot receives. IP-based cloaking escapes the previous tests, since your requests come from your own address. In the URL Inspection tool, click “Test live URL”, then “View tested page”: compare the HTML tab and the screenshot with the page shown in your browser. This is the method Google gives for handling this manual action.

4. Check the reports. Manual actions and “Security issues” in Search Console; in Google, a site:example.com search that brings up titles in a foreign language or products you do not sell betrays content served to crawlers only.

Compliant result: the same codes, the same titles, the same final URLs and the same main content for every agent; the page tested by Google is identical to yours.

How to implement

Before you start

Adapting a page to the device, the language or the subscription is not cloaking as long as crawlers are treated like a visitor of the same type:

Situation Verdict Condition
Dynamic rendering (prerendered version for crawlers) Tolerated Similar content; Google presents it as a workaround it does not recommend
Paid content (paywall) Allowed Google sees the full content and paywalled content markup is in place
A/B test Allowed Googlebot is not sent to a variant chosen for it; 302 redirect and rel="canonical" to the original
Adapting to country or language Allowed with care Googlebot is treated like a visitor from its apparent country; avoid automatic redirection based on the assumed language
Anti-bot challenge lifted for verified crawlers Allowed The page served behind it is the same
Text, links or title added for crawlers only Prohibited Remove
Redirecting only visitors coming from Google Prohibited Remove and look for a hack

Before changing anything, back up the configuration files and record each conditional rule you find: its location, its condition (user agent, IP, referrer, country), its effect.

Apache

Versions Apache 2.4.

Look for user agent and referrer conditions in the configuration and the .htaccess files:

sudo grep -rn -i -E "HTTP_USER_AGENT|HTTP_REFERER|BrowserMatch|SetEnvIf.*User-Agent" /etc/apache2/ /etc/httpd/ /var/www/ --include="*.conf" --include=".htaccess" 2>/dev/null

Example of cloaking rules to remove, typical of a hack or of old-school “SEO”:

RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|gptbot) [NC]
RewriteRule ^(.*)$ /version-robots/$1 [L]

RewriteCond %{HTTP_REFERER} (google|bing)\. [NC]
RewriteRule ^(.*)$ https://site-tiers.example/ [R=302,L]

A rule that returns 403 to a malicious bot is not cloaking: it blocks access without changing the content. Reload after the fix:

sudo apachectl configtest && sudo systemctl reload apache2

Nginx

Versions Nginx 1.24 and later.

sudo grep -rn -E '\$http_user_agent|\$http_referer|\$geoip' /etc/nginx/

Inspect each map block and each if you find. Remove those that change the root, rewrite the URL or add content depending on the crawler:

# To remove
map $http_user_agent $root_dir {
    default            /var/www/site;
    ~*(googlebot|bingbot) /var/www/site-robots;
}
sudo nginx -t && sudo systemctl reload nginx

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

  • Workers: open Workers & Pages and review each Worker attached to a route on the domain. Search the code for User-Agent, cf.botManagement and Referer: a Worker that rewrites the response for crawlers is cloaking.
  • Rules: from the Rules overview, open the redirect, transform and origin rules. An expression that uses http.user_agent, cf.client.bot or http.referer to change the URL, the origin or the content must be removed.
  • Legitimate case: cf.client.bot in a security rule, to exempt verified bots from a challenge, does not change the page served.

Then purge the cache: Caching > Configuration, “Purge Everything”.

AWS

Versions AWS console, November 2026.

On CloudFront, open the distribution, Behaviors tab, and note the associated functions (CloudFront Functions and Lambda@Edge). Review their code: a function that picks the origin or rewrites the URI based on the User-Agent header must be fixed. The CloudFront-Is-Mobile-Viewer header, used to adapt the layout, is legitimate if Googlebot Smartphone receives the mobile version like a smartphone. Run a /* invalidation after the fix.

Shared hosting

On cPanel, Plesk or shared hosting, cloaking almost always comes from a hack: a modified .htaccess, a PHP file added to an images folder, auto_prepend_file in a .user.ini. Apply the search from the Apache section to the .htaccess file of each folder, run the hosting provider's malware scanner and change every access password (FTP, database, administration).

WordPress

Versions WordPress 6.4 and later, WP-CLI 2.x.

wp core verify-checksums
wp plugin verify-checksums --all
grep -rn -i -E "HTTP_USER_AGENT|googlebot|HTTP_REFERER" wp-content/plugins wp-content/themes wp-content/mu-plugins | grep -v "/vendor/" | head -50

Check the wp-content/mu-plugins folder, which the Plugins screen does not list like the others. Remove any plugin presented as able to “serve an optimized version to search engines”. Cache plugins that serve a different version to crawlers must serve the same content. For a hacked site, follow monitor for hacking and content or link injection (opens in a new tab).

Laravel

Versions Laravel 11 to 13.

grep -rn -i -E "userAgent\(\)|User-Agent|isCrawler|CrawlerDetect" app/ routes/ bootstrap/ config/

A middleware that detects a crawler to record statistics or apply a rate limit is legitimate. A middleware that changes the view, the content or the redirect for a crawler is not: remove the conditional branch and serve the same response to everyone.

Next.js

Versions Next.js 15 and 16 (App Router).

Open proxy.ts (named middleware.ts before Next.js 16) and search for userAgent( or isBot. The userAgent() helper from next/server exposes an isBot boolean: if it is used to rewrite the URL or to pick different content for crawlers, remove the branch.

// To remove from proxy.ts
import { NextResponse, userAgent } from "next/server";
import type { NextRequest } from "next/server";

export function proxy(request: NextRequest) {
  if (userAgent(request).isBot) {
    return NextResponse.rewrite(new URL("/version-robots", request.url));
  }
  return NextResponse.next();
}

If the application needs a rendering that is readable without JavaScript, switch to server-side or static rendering rather than to a version reserved for crawlers.

Requesting a review

If a manual action is in progress, fix all the affected pages, then click “Request Review” in the report. Google asks you to explain the problem, the steps taken and their results. Processing usually takes from a few days to a few weeks. See check manual actions (opens in a new tab).

Common mistakes

  • Testing only with curl: IP-based cloaking can only be seen with Search Console's URL Inspection.
  • Keeping dynamic rendering out of habit: it is tolerated if the content is similar, but Google now recommends server-side or static rendering.
  • Redirecting Googlebot to a “default” language while visitors are redirected by country: that is separate treatment.
  • Letting an A/B test run indefinitely: Google states that an unnecessarily long test may be interpreted as an attempt to deceive search engines.
  • Removing the rule without looking for the vulnerability: a hacked .htaccess gets rewritten at the next intrusion.
  • Forgetting AI crawlers: a special version for GPTBot or PerplexityBot raises the same trust problem.

Frequently asked questions

Is dynamic rendering considered cloaking?

Google does not consider dynamic rendering to be cloaking as long as the version served to crawlers is similar to the one visitors get. However, it presents it as a workaround, not a long-term solution, and recommends server-side rendering, static rendering or hydration instead. Using it to serve completely different content to crawlers is still cloaking.

Is a paywall a form of cloaking?

A paywall is not cloaking if Google can see all the content behind the paywall, like a subscriber, and if the site follows Google's guidance on flexible sampling. Publishers must also add paywalled content markup, which indicates which part is restricted. Without this markup, the gap between what Googlebot and the visitor see may be treated as cloaking.

Can I redirect visitors by country without cloaking?

Yes, as long as Googlebot is treated like a visitor from the country it appears to come from, with no exception made for it. Google crawls mostly from US addresses and advises against automatic redirection based on the assumed language, because some versions may never get crawled. Prefer a crawlable language selector and hreflang tags to a forced redirect.

How do I know whether my site is cloaking without my knowledge?

Compare the page received with a browser user agent, a Googlebot one and a smartphone one, then with a Google referrer. Then use Search Console's URL Inspection, which shows the HTML received by the real Googlebot. A different title, unknown links or a redirect specific to one case often reveal a hack. Also check the Manual actions and Security issues reports.

Updated on

Topic checklist (PDF)

And now?

In the “Practices to avoid” topic

  1. Eliminate keyword stuffing
  2. Eliminate manipulative hidden text and links
  3. Eliminate deceptive cloaking
  4. Eliminate artificial doorway pages
  5. Eliminate large-scale duplication with no value
  6. Eliminate mass-produced low-value AI content
  7. Eliminate copied content
  8. Eliminate artificial backlinks
  9. Eliminate fake reviews
  10. Eliminate fake authors and certifications
  11. Eliminate fake statistics and studies
  12. Eliminate misleading structured data
  13. Eliminate fictitious update dates
  14. Eliminate deliberately biased comparisons
  15. Eliminate manipulative prompt injection
  16. Eliminate artificial forum mentions
  17. Eliminate misleading content aimed at bots