2013-07-15 28 views
0

我想禁止我的網站的機器人文件中的一些URL,並且有一些困難。需要阻止一些來自機器人的URL文件

現在我的機器人文件具有以下內容:

User-agent: * 

Allow:/
Disallow: /cgi-bin/ 

Sitemap: http://seriesgate.tv/sitemap.xml 

我不希望谷歌索引以下網址:

http://seriesgate.tv/watch-breakingbad-online/season5/episode8/searchresult/ 

有8000個這樣的多個URL。所以機器人文件中的代碼阻止了所有這些。

,也是我希望禁止搜索框,robots文件,以便搜索頁面不被抓取谷歌,例如這個URL:

seriesgate.tv/search/indv_episodes/friends/ 

任何想法?

回答

0

添加Disallow: /name_of_folder/不允許谷歌抓取到一個文件夾,並添加Disallow: /file_name不允許谷歌抓取特定的文件..

+0

所以我應該在機器人寫文件,因爲我的網站有400顯示的內容,所以我必須編寫涵蓋所有顯示的東西不只是破壞或上面提到的情節。(所有節目和他們的劇集) – alikarimi

+0

最好的方法是將節目放在名爲'shows'的文件夾中,只需簡單地添加'Disallow:/ shows /',但這會導致改變代碼中的鏈接,這可以使用任何代碼編輯器(使用查找和替換選項) –

0

首先,您的robots.txt(如包含在你的問題)是無效的。在User-agent行之後不能有換行符。

其次,你不需要Allow行,因爲一切都是允許的,而不是明確阻止。


如果你想阻止下手 「watch-」 所有的8000個網址,你可以使用:

Disallow: /watch- 

阻止搜索結果中,你可以使用:

Disallow: /search/ 

請注意,您必須檢查是否沒有其他頁面(您不想阻止)與這些Disallow值匹配。

所以您的robots.txt可能看起來像:

User-agent: * 
Disallow: /cgi-bin/ 
Disallow: /watch- 
Disallow: /search/ 

Sitemap: http://seriesgate.tv/sitemap.xml 

這將阻止像URL:

  • http://seriesgate.tv/watch-
  • http://seriesgate.tv/watch-me
  • http://seriesgate.tv/watch-me.html
  • http://seriesgate.tv/watch-/
  • http://seriesgate.tv/search/
  • http://seriesgate.tv/search/some-result
  • http://seriesgate.tv/search/in-titles/foobar.html
  • ...