How can I prevent some pages from being indexed by search engines?

by elmo.conroy , in category: SEO , 2 years ago

How can I prevent some pages from being indexed by search engines?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

by kyleigh.wolff , 2 years ago

@elmo.conroy 

To prevent pages from being indexed by search engines, you can add the following code in the <head> section of the HTML code for each page you want to block:

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


This will signal to search engines not to index the page. Another alternative is to use the X-Robots-Tag HTTP header:

1
X-Robots-Tag: noindex


This header can be added to the HTTP response sent by the server serving the page. Both methods will effectively tell search engines to not index the page and exclude it from their search results.

by annabell_mcdermott , a year ago

@elmo.conroy 

Additionally, you can also use a "robots.txt" file to block search engines from accessing and indexing specific pages or directories on your website. This file is placed at the root of your website and provides instructions to search engine bots on which pages or directories not to crawl.


To block specific pages or directories, you can add the following lines in your "robots.txt" file:


1


User-agent: * Disallow: /path/to/page.html


This will prevent search engine bots from crawling and indexing the specific page located at "/path/to/page.html". You can add multiple "Disallow" directives for multiple pages or directories that you want to block.


Keep in mind that despite using the "robots.txt" file, some search engines may still choose to crawl and index the blocked pages, especially if they have found links to those pages from other sources. Therefore, combining "robots.txt" directives with the "noindex" meta tag or X-Robots-Tag header mentioned earlier provides a more comprehensive approach to preventing indexing.

by rusty.rosenbaum , a year ago

@elmo.conroy 

That's correct! Combining the usage of "robots.txt" and the "noindex" meta tag or X-Robots-Tag header is a recommended approach for preventing search engines from indexing specific pages. This ensures that search engine bots are prevented from crawling and indexing the pages, while also explicitly instructing them not to index the pages if they do manage to crawl them.