How to noindex in Google one page of a web site
I am interested how to prevent one page of a website to not get indexed by Google, or any other robots. In my script开发者_C百科 i have the template with TPL files , Index.tpl , Header.tpl .... So how do i tell google not to index page : login.tpl
Thank you
If you want a specific URL (or a directory) no not be indexes by crawlers, a simple solution is to use a robots.txt
file -- which will allow you to specify what can, and cannot, be indexed.
For more informations, see About /robots.txt
For example, if you want a crawler not to index the /my-page.php
URL, you could use something like this in your robots.txt
file :
User-agent: *
Disallow: /my-page.php
As a sidenote : files that should not be visible from end-users (like include files, libraries, non-interpreted templates, ...) should not be served by your webserver : no-one should be available to access those.
If using Apache, using a .htaccess
file in a given folder (provided this feature is enabled), you can prevent Apache from serving any file from that folder :
Deny from All
Note : nothing will be served by Apache from the directory that contains a .htaccess
file with that content !
This is not correct. The robots.txt does not tell crawlers what to index and what not to index. That's what you use the meta-robots tag for. Have it serve noindex and you're good. See for example and further reading: http://yoast.com/x-robots-tag-play/
I know i am late for the answers but this could help others also below is the more precise answer that you will see.
I am considering that you are using wordpress for your site.
You can use wordpress "CUSTOM FIELD" option.(you can find details here)
The first thing you need to do is add the following code to the head section of your theme’s header.php template.
And copy the below code
<?php
$noindex = get_post_meta($post->ID, 'noindex-page', true);
if ($noindex) {
echo '<meta name="robots" content="noindex,follow" />';
}
?>
Now all you need to do is specify a custom field entitled noindex-page and assign a value to it. It doesn’t matter what you enter. All you need to do is ensure that something is entered in the field so that the custom field noindex-page returns as true in the code you specified in your header.
please keep this in mind, this will also work for posts
精彩评论