Understand X-Robots-Tag: noindex for Beginners

By | October 22, 2019

X-Robots-Tag is a kind of http response header, it can tell search engine how to process your html page. In this tutorial, we will discuss X-Robots-Tag: noindex for beginners.

understand x-robots-tag noindex

The value of X-Robots-Tag

noindex – Instructs search engines to not index the page
nofollow – Instructs search engines to not follow links on the page
nosnippet – Instructs search engines to not display a snippet for the page in search results
noarchive – Instructs search engines to not offer a cached version of the page in search results
noodp – Instructs search engines to not use information from the Open Directory Project for the page’s title or snippet
notranslate – Instructs search engines to not offer translation of the page in search results (Google only)
noimageindex – Instructs search engines to not index images on the page (Google only)

As to code:

X-Robots-Tag: noindex

It is same to

<meta name="robots" content="noindex">

How to apply X-Robots-Tag in wordpress

You can send a http response server by php in wordpress. Look at code below:

<?php
header("X-Robots-Tag: noindex", true);
?>

You also can use .htaccess file to send X-Robots-Tag

Send X-Robots-Tag with .htaccess

Here is an example:

<FilesMatch ".(css|js)$">
Header set X-Robots-Tag "noindex, noarchive, nosnippet"
</FilesMatch>

This code means search engine will not index, cache and dispaly your css and js file.

Category: PHP

One thought on “Understand X-Robots-Tag: noindex for Beginners

  1. Rod Linsey

    This piece of writing is actually a fastidious one it helps new internet viewers, who are wishing for blogging.|

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *