: X-Robot-tag noindex not appearing in header I am trying to include the following in my response header to all resources in multiple directories (dirone/dirtwo/dirthree/direfour) from an Apache server.
I am trying to include the following in my response header to all resources in multiple directories (dirone/dirtwo/dirthree/direfour) from an Apache server.
X-Robots-Tag: noindex, nofollow
In my httpd.conf file I have added the setting to the dirone underneath my main directory declaration.
It is not producing the additional item in the response header. Do you see what I am doing wrong?
<Directory />
Options FollowSymLinks Includes
AllowOverride None
</Directory>
<Directory "/web/sitename/docs/dirone">
Header set X-Robots-Tag "noindex, nofollow"
</Directory>
Additional information. I am moving away from the robots.txt approach, we do not use .htaccess files and I want the header in all resources in those directories and their sub-directories to have X-Robots-Tag: noindex, nofollow in them as well.
Thanks for your help.
More posts by @Sherry384
1 Comments
Sorted by latest first Latest Oldest Best
I think the problem is that the Header directive shouldn't go in a Directory section. Instead it should go with the other configuration for sitename and use a Files directive.
So in your sitename configuration (even in your .htaccess) you should use:
<Files "dirone/*">
Header set X-Robots-Tag "noindex, nofollow"
</Files>
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.