K
K
k_arlimov2022-01-28 23:23:00
Google
k_arlimov, 2022-01-28 23:23:00

Server response with X-Robots-Tag for files only?

Can the server response Header set X-Robots-Tag "noindex"only apply to files? For example .pdf, .doc.?

Or is it possible to do it for the page url? For example, for example.com/someurl.

In all the examples that I found:

<Files ~ "\.(png|jpe?g|gif)$">
  Header set X-Robots-Tag "noindex"
</Files>

Is it really impossible to implement this not for a file, but for the page url?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2022-01-28
@karabanov

You searched badly:

<IfModule mod_headers.c>
    <If "%{REQUEST_URI} =~ m#blalabla#">
        Header set X-Robots-Tag "noindex"
    </If>
</IfModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question