Reputation: 11
I want to noindex all websites/URLs in the subdirectory "author".
Examples:
example.com/author/torben
example.com/author/lucy
example.com/author/*
.htaccess seems to be the right place to do it.
I found some code that should do the trick but does not
<If "%{REQUEST_URI} =~ m#^/author/#">
Header set X-Robots-Tag "noindex"
</If>
Something is wrong
curl -I https://www.example.com/author/torben
does not show a noindex.
What am I doing wrong? Thanks for you help. It is much appreciated
EDIT:
I searched and found something that can do the trick
<IfModule mod_headers.c>
<If "%{THE_REQUEST} =~ m#/author/?#">
Header set X-Robots-Tag "noindex"
</If>
</IfModule>
Upvotes: 1
Views: 463