機車哩~~spider 也有這種來陰的,不照規定來的:有已寫好的 robots.txt 讓 spider 知道這兒歡不歡迎它們,但就有不看的傢伙存在

沒關係,上網 google 一下發現,還是有網友有法子可以治那些網路垃圾

有國外網友寫了這一篇資料:How to keep bad robots, spiders and web crawlers away

0.在使用這份資料之前,需先注意 apache2 是否有開啟支援 .htaccess

 看 /etc/apache2/sites-available/default 設定檔,”None” 才是有開啟

  AllowOverride None

 

作者提供了兩個方法供使用

1.使用 .htaccess 來限定 BOT 的行為

2.設 Robot trap (管他叫:網路爬虫用陷阱? robot抓取器? -.- 自行體會中文的意境~~)

 紅使用了第二個『Robot trap』來抓 " robot 逃犯 "

 下載網站提供的 robotrap.zip 檔,解壓縮後,上傳至 www根目錄(不含 robotrap目錄)

.htaccess , ailtrap.shtml , X.html

<DIR botsi> .htaccess , index.shtml

<DIR botsv> .htaccess , index.shtml

3.修改 /www根目錄/.htaccess 檔案內容

     RewriteEngine on
  Options +FollowSymlinks
  RewriteBase /
  RewriteRule ^.*\.html /botsv/index.shtml
  ErrorDocument 400 /botsv/index.shtml
  ErrorDocument 402 /botsv/index.shtml
  ErrorDocument 403 /botsv/index.shtml
  ErrorDocument 404 /botsv/index.shtml
  ErrorDocument 500 /botsv/index.shtml

4.設定好 .htaccess 後,一定要先測試原先網頁是否能正常運作

5.收工~等待驗收成果了.. 

相關文章:

小娟 – 孤單聖誕 Christmas Alone(番外篇)
小娟 – 孤單聖誕 Christmas Alone(番外篇)

[Engagement] 2011.09.04 湰貿 & 容泇
[Engagement] 2011.09.04 湰貿 & 容泇

一代銘機 Nikon 5700
一代銘機 Nikon 5700

[婚禮紀錄] 2008.12.27 建文 & 美燕婚禮(圖多)
[婚禮紀錄] 2008.12.27 建文 & 美燕婚禮(圖多)

[Wedding] 2011.09.10 為閔 & 佑禛
[Wedding] 2011.09.10 為閔 & 佑禛

2009.01.13 石門水庫紅楓行
2009.01.13 石門水庫紅楓行

Tags: