Media

Improving Google Images CTR with 204 Responses

Improving CTR through opting out of Google Images inline linking

Improving Google Images CTR with 204 Responses
Author
Carlos Sánchez
Topics
Media servers
Published
Reviewed

Normally, when we search for an image via Google Images, the results we see are the images taken from the website where they are hosted. This way, Google shows the image in its original size and quality and allows us to download or open the URL directly from the image search without needing to visit the website to which the image belongs.

However, there are other images that, when we search for them via Google Images, appear to be of large size, but the preview appears blurry and small, and if we try to download it from Google, the image barely has any quality. If we attempt to click on this type of image, we find that it did indeed have a high resolution, but the link doesn't lead us to the image URL itself. Instead, it directs us to the web page where the image is displayed, forcing the user who wants the high-quality image to visit the original website.

This is a way to work on CTR with Google Images, and I’m going to explain step by step what it is, how to implement it, and for which projects this implementation might or might not be convenient.

Opt out of Google Images inline linking

As an example to explain what this is and how it happens, I have used this image from the search result: "seo employee in the world map the lancet".

Let's check the effect, since in theory, this image is 5051 pixels with a weight of 3.20MB, but it looks blurry on Google Images.

Vinculos Intercalados de Google Imagenes respuesta 204

If we carefully check where the image comes from, we see that Google is not calling the original domain of the image through the src (as it usually does), but instead has its own version of the image, which only weighs 14kb and measures 211px in width:

dataimage hotlinking de google

Meanwhile, in other images, we can see that Google captures them exactly as they are from their original web source via the src, allowing the user to download the original image without needing to access the website.

carlos sanchez google imagenes hotlinking
These are visual examples. These images may not have this configuration at the time you are viewing the article.

This is not a casual or arbitrary matter from Google. It is an action taken by the website called inline image linking, which forces the user to visit the page where the image is linked if they wish to download the high-quality version of it. This avoids bandwidth usage if users don’t access the image and, most importantly, helps bring users closer to our conversion goals, as they must visit our website to view the image in good quality.

In the case of the page used as an example, the user will see more information about the article, more download options, and will “consume” the adverts present on the website.

In this particular page, we can check what happens if we access the sample image.

We can see that, from my website, I can link it by making an SRC call to their website (this image is not hosted on my server). Therefore, it’s not preventing hotlinking, but rather is another type of practice.

Image inserted and hosted on The Lancet's website

All this is called inline image linking. But perhaps the term might seem confusing, so I will explain it to make it clearer.

What are inline image links?

When we ensure that an image from Google Images does not display the original image but rather a "low-quality copy", it is known as an "inline image link". The term is somewhat clunky, but if we look at its origin and how it’s named in English, inline linking, it makes much more sense.

This practice means that Google embeds the image using a Data:uri.

Data URIs, URLs prefixed with the data: scheme, allow content creators to embed small files inline within documents.

— Mozilla Developer

This means that images and other elements can be incorporated into HTML without needing to reference external resources. It’s a way of "coding our image".

This code would have an equivalent weight, which is why Google, to avoid overloading its code and making it excessively heavy (since it can't call it externally from your domain), deploys a compressed version. Otherwise, the code could become excessively large (I make a curious reference).

Since it is "linked", as it refers to an external image but in an internal way within the code, the term would be: "inline linking". This type of terminology is common when dealing with code. For example: "inline CSS" or "inline Javascript", which refers to CSS or Javascript directly embedded in the HTML code.

The questions we might ask are:

So, let’s go step by step, answering each of these questions.

How does this practice affect Google?

We can see what Google says about this practice in its own documentation:

Opt out of Google Images inline linking

If you choose, you can prevent the full-sized image from appearing in the Google Images search results page by opting out of inline linking in Google Images search results.

To opt out of inline linking:

  1. When your image is requested, examine the HTTP referrer header in the request.
  2. If the request is coming from a Google domain, reply with a 200 HTTP status code, or a 204 HTTP status code and no content.

Google will still crawl your page and see the image, but will display a thumbnail image generated at crawl time in search results. This opt-out is possible at any time, and doesn't require re-processing of a website's images. This behavior isn't considered image cloaking and won't result in manual actions.

Alternatively, you can prevent the image from appearing in search results entirely.

— https://developers.google.com/search/docs/appearance/google-images 30/10/2026

Update 30/10/2026: I have updated the quote and the link. The documentation now lives in Google's Image SEO best practices, under «Opt out of Google Images inline linking», and the quote above is Google's own English wording. The procedure hasn't changed: check the referrer and, if the request comes from a Google domain, reply with a 200 or a 204 and no content.

This practice, as we can see, does not cause a cloaking issue. And if what you want is the opposite, keeping your images out of Google altogether, I explain it in preventing image indexing.

It’s important to highlight a point that may lead to confusion. In the documentation, it explains that the 204 response code (a code that indicates the page is valid but returns no content) should be offered to Google via the HTTP referer header (I’ll explain how in the next step) when the request comes from a Google domain. This 204 response code should never be used for its User-Agent (that is, the search engine bot). If you block images for a User-Agent, the crawler or user with a blocked User-Agent will not be able to view the images, meaning they cannot crawl or index them. With inline image links, you prevent Google from embedding those images from its domain, but they can still index and rank them on Google Images.

This means that to perform this practice correctly, you should not block the User-Agent but instead prevent the image from being embedded from Google's domain (in the next step, we’ll see how).

Configuring inline image links with htaccess

I explain how to configure this on an Apache server (in the htaccess file), and every code block also has a tab with the nginx version. Wherever you see yourdomain.com, replace it with your own domain.

Explanation of the codes to use

We must consider both the position of our htaccess file (the higher the better) and where our htaccess file is hosted. We might be using software that places an htaccess file exactly where the directory of our images is located.

Whenever possible, these codes should go inside an <IfModule mod_rewrite.c> and the Rewrite engine should be activated with RewriteEngine On.

Rewritecond and RewriteRule

With Rewritecond, we explain the condition. For example, that the request comes from a particular domain. And with RewriteRule, we define the rule to apply to those selected conditions.

In this case, I have used this example of code in a simulated htaccess located where the image directory of the WordPress back-end is used, in wp-content/uploads. However, you can place it in the directories you consider. And from RewriteRule or with RewriteCond, you can create a conditional so that it only happens in the directories you specify and only with images. For instance, with:
RewriteRule ^(.*\.(gif|jpe?g|png|webp))$ - [R=204,NC,L]
Instead of using the Rewrite I’ve shown in the examples, there are many cases and alternatives to select a specific directory or file extensions that should return a 204. In any case, the examples I provide below already filter by file extension, so they only affect images even if you put them in the root htaccess file.

ErrorDocument 204

A particular document for the 204 response code will be generated, which is empty, to ensure no content is returned, as indicated in Google's documentation.

Preventing Hotlinking

We can prevent any domain that isn't ours from embedding our images using our URL. This practice is often done unknowingly or to save bandwidth. In fact, Google Images does this "hotlinking" by default. However, there are more fun ways to prevent it. With this practice, we prevent Hotlinking and make Google Images perform Inline Linking.

Apache · in the .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://([^/]+\.)?yourdomain\.com/ [NC]
RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png|gif|webp|avif)$ [NC]
RewriteRule ^ - [R=204,L]
ErrorDocument 204 '<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"></html>'
</IfModule>

The first condition, !^$, is the key one: it lets through requests that arrive with no referrer. The second lets through those coming from your domain and its subdomains (www included), and the third makes the rule touch images only.

Update 30/10/2026: I have fixed this code. The previous version returned a 204 to anything that didn't carry my domain as the referrer, and that includes requests with no referrer at all: someone opening the image directly, sites and browsers that don't send it, and crawlers, which don't arrive from any page (in your logs, Googlebot-Image requests usually show an empty referrer, «-»). In other words, instead of getting inline linking, it could leave Google without the image to index.

Keep three things in mind:

Clean practice of configuring inline image links [Recommended]

This way, we specifically prevent any Google subdomain or domain from embedding our images on their site. Meanwhile, other domains can embed them normally. And if we want to continue preventing hotlinking from other URLs, we can create another specific rule, such as redirecting to an image URL with a watermark of the relevant project.

To cleanly prevent Google hotlinking, the code would be as follows:

Apache · in the .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^https?://([^/]+\.)?google\. [NC]
RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png|gif|webp|avif)$ [NC]
RewriteRule ^ - [R=204,L]
</IfModule>

Update 30/10/2026: I have restored the backslashes that escape the dots (without them, a dot matches any character), widened the referrer condition so it covers any Google subdomain, not just www, and added AVIF, one of the formats Google Images supports. The nginx version is new here: it used to be further down, without the brace that closes the location.

Blocking via User-Agent [DO NOT DO]

If we block via User-Agent, we prevent the image from being crawled, so this is not a recommended practice.

In this way, we block crawling entirely, meaning we will not be able to rank in Google Images properly.
<IfModule mod_rewrite.c>
# RewriteEngine On
# RewriteCond %{HTTP_USER_AGENT} ^.*(Googlebot.*).*$ [NC]
# RewriteRule ^.*$ - [R=204,NC,L]
# ErrorDocument 204 '<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"></html>'
</IfModule>

Applying Google embedded link disabling in Nginx

You will find the nginx code in the nginx tab of the two blocks above: the one for preventing hotlinking and the one for the clean practice. It goes inside the server block, with a location for images that checks the referrer.

Watch out if you already have a location for images (for caching, for example): nginx handles each request with a single location, so put the if or the valid_referers inside the one you already have.

Update 30/10/2026: The nginx code that used to be here was missing the brace that closes the location, and without it nginx won't load the configuration (nginx -t fails). I have fixed it, along with the backslashes in the regular expression, and moved it into the tabs above, next to a new version for preventing hotlinking.

Remember: you must restart or reload the Nginx server after making a change for these to take effect.

Is it useful to prevent embedded links from Google Images?

From both a technical and a marketing perspective, it makes sense. We avoid consuming bandwidth from our hosting whenever someone searches for images from our site and cannot download them in high quality from Google Images without visiting our website.

Depending on the user, they might initially think the image is of poor quality. However, on the other hand, we force the user to visit our website if they are interested in our content. In most cases, it is not useful for many users to download images from your site without even visiting it.

Why does CTR improve in Google Images?

With this practice, we will not directly make a user click on our image instead of the competitor’s. This is achieved with the image’s own appeal and characteristics, and with the title of the URL where it is linked, among other factors.

However, if the user finds our image relevant to their search, and if they want to see it in good quality, they will have no choice but to visit our website. This will make it easier for them to enter the funnel we have set up.

Video explanation

In a live session about SEO Facts, I addressed this topic, where you can see additional information:

Warning: The video is in Spanish Language

The effect, although I got confused during the live session. It is not done via User-Agent, but via domain.

Bibliography

If you like this article, you would help me a lot by sharing my content:
Training
Interested in Advanced SEO Training?

I currently offer advanced SEO training in Spanish. Would you like me to create an English version? Let me know!

Tell me you're interested
You might be interested in other articles:
SEO Articles