X-Robots-Tag HTTP Header
Contents
No Index
1 |
header("X-Robots-Tag: noindex", true); |
No Index and No Follow
1 |
header("X-Robots-Tag: noindex, nofollow", true); |
Apache Server Implemenation
Implemenation on the .htaccess file
1 2 3 |
<FilesMatch ".(txt|docx)$"> Header set X-Robots-Tag "noindex, noarchive, nosnippet" </FilesMatch> |
No Index Specific File in Apache
1 2 3 |
<FilesMatch "example.txt"> Header set X-Robots-Tag "noindex" </FilesMatch> |
Ngnix server Implemenation
1 2 3 |
location ~* \.(doc|pdf)$ { add_header X-Robots-Tag "noindex, noarchive, nosnippet"; } |
No Index Specific File in Ngnix
1 2 3 |
location = example.txt { add_header X-Robots-Tag "noindex"; } |