How to use X-Robot tag?

Discussion in 'Search Engine Optimization' started by Jennifer Martin, Jun 11, 2016.

  1. Jennifer Martin

    Jennifer Martin
    uix_expand uix_collapse
    Member

    Joined:
    Mar 10, 2016
    Messages:
    36
    Likes Received:
    1
    Hello Friends,

    Recently I came across with the term as "X-Robot" tag. Please tell me what is the use of this tag, how it is implement using code.
     
  2. Joseph.Shivell

    Joseph.Shivell
    uix_expand uix_collapse
    Community Leader
    Community Leader

    Joined:
    Oct 8, 2009
    Messages:
    2,265
    Likes Received:
    697
    As you my know, the "robots" meta tag is used to give instructions to the SE robots, telling them what to do, or not to do, with the pages in a website. The format is usually like this:

    <meta name="robots" content="no index" />

    However, this will only work with HTML files. If you have a non-HTML file, such as a PDF or video, you can use the "x-robots" tag instead. In addition to being used for different types of files, the format is different as well. Where the meta tag doesn't use the word "tag" in the coding, the "x-robots-tag" does. With the "x-robots" tag, you also don't need to sepecify which is the name and which is the content, and the name and content are separated with a colon and space, not with an "=" sign and quotation marks. It also does not have the "<" and "/>" marks. The example above as an "x-robots" tag would look like this:

    X-Robots-Tag: noindex
     
    • Like Like x 1
  3. Jennifer Martin

    Jennifer Martin
    uix_expand uix_collapse
    Member

    Joined:
    Mar 10, 2016
    Messages:
    36
    Likes Received:
    1
    Thanks Joseph for explaining X-Robots-Tag in such a simple way. I got clear explanation of how it is different from meta tag which is used in HTML files.
     
    • Like Like x 1
  4. actonyinc

    actonyinc
    uix_expand uix_collapse
    New Member

    Joined:
    Mar 20, 2015
    Messages:
    17
    Likes Received:
    0
    You can try the following in your .htaccess file

    #modify query string condition here to suit your needs
    RewriteCond %{QUERY_STRING} (^|&)m=_\! [NC]
    #set env var MY_SET-HEADER to 1
    RewriteRule .* - [E=MY_SET_HEADER:1]

    #if MY_SET_HEADER is present then set header
    Header set X-Robots-Tag "noindex, nofollow" env=MY_SET_HEADER
     

Share This Page