How do I disallow specific page from robots.txt

二次信任 提交于 2019-11-28 00:39:23
AlexanderMP
Disallow: /thank-you-for-commenting

in robots.txt

Take a look at last.fm robots.txt file for inspiration.

robots.txt files use regular expressions to match pages, so to avoid targeting more pages than you intend, you may need to add a $ to the end of the page name:

Disallow: /thank-you-for-commenting$

If you don't you'll also disallow page /thank-you-for-commenting-on-this-too

You can also add a specific page with extension in robots.txt file. In case of testing, you can specify the test page path to disallow robots from crawling.

For examples:

 Disallow: /index_test.php
 Disallow: /products/test_product.html
 Disallow: /products/     

The first one Disallow: /index_test.php will disallow bots from crawling the test page in root folder.

Second Disallow: /products/test_product.html will disallow test_product.html under the folder 'products'.

Finally the last example Disallow: /products/ will disallow the whole folder from crawling.

Waqas Ahmad

This is very simple, any page that you want to disallow, just give root url of this file or folder. Just put this into your robots.txt file.

Disallow: /thank-you-for-commenting
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!