Preventing indexing of IMAGE files

I want search engines to INDEX my site, but I do NOT want them to index the images… I am trying the following, added to an index.html file added to the UPLOADS directory… for you experts out there… will this stop the indexing of my images? Will it cause any problems with access to the images for the front-end?

<Directory “”>
<FilesMatch “.(jpg|jpeg|png|gif|png)$”>
Header set X-Robots-Tag “noimageindex”

OR - is THIS one (in the root .htaccess file) better?

<Files ~ “.(gif|jpg|jpeg|png|)$”>
Header set X-Robots-Tag “noindex, nofollow”

Either of those should work, however that is .htaccess syntax and therefore is unlikely to have any effect if added within an index.html file. It needs to be added in an .htaccess file at root level provided you are using an apache server.

Don’t waste your time my friend, it’s not worth it.

I will share something related to .htaccess to get the idea of why it’s not worth it.

Search engines, especially now AI bots are smart enough to apply the robots=off mechanism, much like we have in wget command.

To give you an idea, we can guide a bot to emulate the behavior of a browser to go undetected and simply ignore the robots.txt file.


wget \
    --user-agent="<user-agent>" \
    --header "cookie: <name>=<value>; <name>=<value>; <etc...>" \
    --adjust-extension \
    --continue \
    --convert-links \
    -e robots=off \
    --no-parent \
    --page-requisites \
    --mirror \

Plus, indexing images help with increasing your traffic, assuming you named your images accurately to match the page’s / post’s content.

So, to repeat myself: don’t! waste! your time!

Google’s recommended way to remove images from the index is to use robots.txt:

User-agent: Googlebot-Image
Disallow: /
1 Like