In short
An image only appears in Google Images, in Discover or in a Google Lens search if crawlers can download the file. The task is to check, for every host that serves your images (main domain, subdomain, CDN, bucket), that robots.txt does not disallow them, that the firewall and hotlink protection let crawlers through, and that no X-Robots-Tag: noindex header excludes them. Expected result: an image file requested by Googlebot-Image returns 200 with an image/… content type.
Why it matters
Google crawls images with the Googlebot-Image crawler. According to its documentation, robots.txt rules addressed to this crawler apply to Google Images, Discover and every Google Search feature that displays images, logos or favicons.
Three mechanisms remove images from these results without anyone having decided to:
- The robots.txt of the wrong host. A robots.txt file's rules only apply to the host, protocol and port where it is published. If your images are served from
cdn.example.com, what counts ishttps://cdn.example.com/robots.txt, not the one onwww.example.com. A robots.txt inherited from a staging environment (Disallow: /) on the images subdomain is enough to make them disappear. - Overly broad rules.
Disallow: /wp-content/,Disallow: /*.jpg$or a/media/folder disallowed “to save crawl budget” exclude every image inside them. - Protection layers. A firewall that returns 403 to crawlers, an
X-Robots-Tag: noindexheader set on an entire folder, or misconfigured hotlink protection.
On the AI side: generative engines' crawlers (OAI-SearchBot, PerplexityBot, Claude-SearchBot…) crawl your pages according to your access policy. Their vendors do not document in detail how they handle image files; what matters is that your pages and the text describing the images are accessible to them. See configure robots.txt to match these goals (opens in a new tab).
What it improves
- Image indexing A prerequisite for appearing in Google Images, Discover and visual searches.
- Logo and favicon display in Google results, which also go through Googlebot-Image.
- Page rendering Google sees the page as visitors see it, images included.
- Multimodal searches An image that is not crawled cannot send people to your page from Lens.
- Web page rankings No direct effect; a blocked image does not penalize the page, it simply stays invisible in image search.
How to check
1. Identify the hosts that serve images. In the browser console, on a few typical pages:
[...new Set([...document.images].map(i => new URL(i.currentSrc || i.src).host))];
2. Read the robots.txt of each host.
for host in www.example.com cdn.example.com; do
echo "== $host"; curl -s -o - -w "HTTP %{http_code}\n" "https://$host/robots.txt" | head -30
done
Google treats a robots.txt that returns 404 or another 4xx error (except 429) as if there were no restrictions. A 5xx error, on the other hand, blocks crawling of the whole host for the first few hours.
Search Console's robots.txt report shows the files Google fetched for the property's hosts, with the date and any errors.
3. Test an image's response with the crawler's user agent.
curl -s -o /dev/null -D - -A "Googlebot-Image/1.0" https://cdn.example.com/images/chaudiere-entretien-nantes.jpg \
| grep -i -E "^HTTP|content-type|x-robots-tag"
Compliant result:
HTTP/2 200
content-type: image/jpeg
A 403, an HTML challenge page instead of the image, or an x-robots-tag: noindex line indicate a problem. Your test comes from your own IP address: some firewalls treat the real crawler differently. The logs settle it.
4. Check what Google actually loaded. In URL Inspection, click “Test live URL”, then “View tested page”, “More info” tab: the list of resources that could not be loaded shows images blocked by robots.txt or returning errors.
5. Read the logs.
grep "Googlebot-Image" /var/log/nginx/access.log | awk '{print $9}' | sort | uniq -c | sort -rn
A majority of 200 (and 304) responses is the expected result.
How to implement
Before you start
robots.txt rules for images:
User-agent: *
Disallow: /admin/
Disallow: /panier/
Disallow: /recherche
Sitemap: https://example.com/sitemap.xml
This file disallows no images: that is the desired state in most cases. To deliberately exclude a folder from Google Images only (internal photos, visuals under a restricted license):
User-agent: Googlebot-Image
Disallow: /images/prive/
Two syntax traps:
- A crawler that finds a group addressed to it by name no longer applies the
*group: copy into theGooglebot-Imagegroup any disallow rules that should also apply to it. - If your file contains a restrictive
User-agent: Googlebotgroup, check that it does not also target your image folders, or create an explicitGooglebot-Imagegroup to remove any ambiguity.
To remove an image that is already indexed, Google recommends the X-Robots-Tag: noindex header on the file, provided the image stays crawlable so that the crawler can read the header. The full syntax is in check meta robots and X-Robots-Tag (opens in a new tab).
Apache
Versions Apache 2.4.
Look for rules that affect images:
grep -r -n -i -E "x-robots-tag|googlebot|http_referer|\.(jpe?g|png|webp|avif|gif)" /var/www/example/public/.htaccess /etc/apache2/sites-enabled/
Hotlink protection must let through requests with no referrer (which is what crawlers send) and, if you want full-size display in Google Images, Google's referrers:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?example\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^/]+\.)?google\.[a-z.]+/ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^/]+\.)?bing\.com/ [NC]
RewriteRule \.(jpe?g|png|gif|webp|avif)$ - [F,NC,L]
</IfModule>
Remove any line such as Header set X-Robots-Tag "noindex" applied to images you want indexed. The .htaccess file takes effect immediately; for the server configuration: sudo apachectl configtest && sudo systemctl reload apache2.
Nginx
Versions Nginx 1.24 and later.
grep -r -n -i -E "x-robots-tag|googlebot|valid_referers|\.(jpe?g|png|webp|avif)" /etc/nginx/
Hotlink protection compatible with crawlers and Google Images:
location ~* \.(jpe?g|png|gif|webp|avif)$ {
valid_referers none blocked server_names ~\.google\. ~\.bing\.com;
if ($invalid_referer) {
return 403;
}
expires 30d;
}
none allows requests with no referrer, including those from crawlers. Also check that no add_header X-Robots-Tag "noindex" applies to these locations, then run sudo nginx -t && sudo systemctl reload nginx.
Cloudflare
Versions Cloudflare dashboard, all plans, November 2026.
- Hotlink Protection (
Security > Settings, client-side protection filter, security settings): Cloudflare states that it has no impact on crawling, but that it can prevent images from being displayed on sites such as Google Images, Pinterest or Facebook. If that visibility matters, turn it off or put the images you want to share in a folder namedhotlink-ok, which Cloudflare does not check. - Security rules and bots: a challenge (Managed Challenge) on
/images/or a rule that blocks bots also stops Googlebot-Image. Verified bots can be identified with thecf.client.botfield; see check CDN, Cloudflare and WAF (opens in a new tab). - R2 or an images subdomain: publish a robots.txt at the root of that subdomain, or let it return 404, but never a copy containing
Disallow: /.
After fixing, purge the cache: Caching > Configuration.
AWS
Versions Amazon S3, CloudFront and AWS WAF, console and AWS CLI v2, November 2026.
- S3 with CloudFront: CloudFront serves whatever the bucket contains. If the distribution's domain (
images.example.comord111111abcdef8.cloudfront.net) does not provide a robots.txt, the request often returns 403 or 404: Google treats these codes as no restrictions. To be explicit, upload a permissiverobots.txtfile to the root of the bucket:
printf "User-agent: *\nAllow: /\n" > robots.txt
aws s3 cp robots.txt s3://example-images/robots.txt --content-type text/plain
aws cloudfront create-invalidation --distribution-id EDFDVBD6EXAMPLE --paths "/robots.txt"
- AWS WAF: depending on its configuration, the Bot Control rule group can block crawlers. Check in the AWS WAF console that verified search engine bots are allowed on image paths.
- S3 metadata: an
x-robots-tagheader may have been added to the objects or by a CloudFront response headers policy. Check it with the curl command from the “How to check” section.
Shared hosting
You control the .htaccess file and robots.txt: apply the Apache section. In cPanel, the Hotlink Protection tool (Security section) writes hotlinking rules to .htaccess; check that it allows direct access (the option that allows requests with no referrer) and add Google's domains if needed.
WordPress
Versions WordPress 6.4 to 7.1.
- robots.txt: WordPress's virtual file only disallows
/wp-admin/(with an exception foradmin-ajax.php). Old advice that addsDisallow: /wp-content/orDisallow: /wp-content/uploads/blocks every image: remove these lines in your SEO plugin's robots.txt editor or in the physical file at the root. - Security and image protection plugins: the “anti-hotlinking” or “image protection” options of some plugins block right-clicking or referrers; check that they let requests with no referrer through.
- Image CDNs from optimization plugins: if images are rewritten to a third-party domain, test that domain's robots.txt and response.
Shopify
Versions Shopify (robots.txt.liquid template), all plans, November 2026; same principle for Wix, Squarespace and Webflow.
Store images are served by Shopify's infrastructure, which manages their host. Your only lever is the robots.txt.liquid template: check that no added rule targets /cdn/ or file folders. Same logic on Wix, Squarespace and Webflow: do not add disallow rules on media paths in the robots.txt editor.
Next.js
Versions Next.js 15 and 16 (App Router).
With the next/image component, images go through /_next/image?url=…. A disallow on /_next/ in app/robots.ts, sometimes added by mistake, blocks these URLs:
import type { MetadataRoute } from 'next';
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
disallow: ['/api/', '/compte/'],
},
sitemap: 'https://example.com/sitemap.xml',
};
}
If images are served by an external loader (image CDN), apply the robots.txt and HTTP response checks to its domain.
Common mistakes
- Checking the site's robots.txt and forgetting the CDN's or the images subdomain's.
- Copying the staging robots.txt (
Disallow: /) to the media subdomain at launch. - Disallowing
/wp-content/or image extensions “to save crawl budget”. - Blocking an image you want deindexed via robots.txt: Google can no longer read the
noindexheader. Leave it crawlable withX-Robots-Tag: noindex. - Hotlink protection that rejects requests with no referrer: crawlers are blocked.
- Drawing conclusions from a curl test alone: the firewall may treat your IP differently from the real crawler's.
- CSS background images: even when crawlable, they are not indexed by Google, which only indexes images in
imgelements.
Frequently asked questions
Which Google crawler crawls images?
Google crawls images with Googlebot-Image, whose robots.txt token is Googlebot-Image. Rules addressed to it apply to Google Images, Discover and every Google Search feature that displays images, logos or favicons. This token therefore lets you exclude images from these results without affecting how Googlebot crawls your web pages.
Does my image CDN need its own robots.txt?
Yes, if your images are served from another host, such as cdn.example.com. A robots.txt file's rules only apply to the host where it is published: the one on your main domain does not apply to the CDN. If the CDN returns a 404 error for robots.txt, Google considers there are no restrictions; a copy containing Disallow: /, however, blocks every image.
Does hotlink protection prevent images from being indexed?
Not necessarily. Crawlers request images with no referrer: a rule that allows requests with no referrer lets them through. Cloudflare states that its protection has no impact on crawling, but that it can prevent images from being displayed on Google Images or Pinterest. Allow Google's domains in your rules if full-size display in Google Images matters to you.
How do I remove an image from Google Images?
To remove an image from Google Images, Google suggests disallowing its URL for the Googlebot-Image crawler in robots.txt, or adding the X-Robots-Tag: noindex header to the file while keeping it crawlable. The noimageindex robots meta tag excludes a page's images, but they can still be indexed from other pages. Search Console's Removals tool acts faster, but only temporarily.
Resources
- Google Search Central: Google's common crawlers (Googlebot-Image)developers.google.com
- Google Search Central: how Google interprets the robots.txt specificationdevelopers.google.com
- Google Search Central: prevent images on your page from appearing in search resultsdevelopers.google.com
- Google Search Central: image SEO best practicesdevelopers.google.com
- Cloudflare: Hotlink Protectiondevelopers.cloudflare.com
- Next.js: robots filenextjs.org
Updated on
Topic checklist (PDF)