0

我有一个在 CentOS 下运行 apache 2.2 + php 5.4 的托管 linux,由于内部服务器错误问题,我无法禁止使用.htaccess的坏机器人,我有大量由机器人使用的带宽。我想禁止他们,但使用从 IP 拒绝我发现很难匹配他们,因为他们的 IP 以很小的频率变化,而且我每次 chenge ip a bot 时都必须添加新的 ip。我认为目标应该是在根目录中使用 .htaccess 使用用户代理匹配,但是当我将此文件放在根目录中时,我收到内部服务器错误 500并且日志显示RewriteCond: bad flag delimiters。我也有robots.txt根目录中的文件,并带有对遵循此规则的机器人的指令禁止。这是我的 .htaccess 文件,看看有什么问题吗?感谢您的回复。

################################################################################
############################### Custom Error Pages #############################
################################################################################
ErrorDocument 401 /err/401.php
ErrorDocument 403 /err/403.php
ErrorDocument 404 /err/404.php
ErrorDocument 500 /err/500.php
ErrorDocument 503 /err/503.php
ErrorDocument 504 /err/504.php
################################################################################
################################ Redirect Requests #############################
################################################################################
RedirectMatch /eml/a71mail.php /eml/mail.php
RedirectMatch /files/Alecos-280507.jpg /img/Immagine.jpg
RedirectMatch /img/Ak71_05.jpg /img/Immagine.jpg
################################################################################
#################### Ban Bad/Evil Bot/Crawler/Spider Using IP ##################
################################################################################
Order allow,deny
#SpamBot - Try Ban Them Using Static IP
Deny from 176.31.122.216
Deny from 37.187.71.183
Deny from 37.187.89.129
Deny from 78.46.105.91
Deny from 74.95.0.186
Deny from 117.78.13.17
Deny from 12.232.58.137
Deny from 85.214.219.253
#BLEXBot Not Has Static IP: 198.143.133.XXX
Deny from 198.143.133.
#Baiduspider Not Has Static IP: 180.76.5.XXX
Deny from 180.76.5.
#AhrefsBot Not Has Static IP: 5.10.83.XXX
Deny from 5.10.83.
#SeznamBot Not Has Static IP: 77.75.77.XXX
Deny from 77.75.77.
#linkdexbot Has Multiple Static IP: 54.205.139.XXX/54.234.158.XXX/54.227.139.XXX
Deny from 54.205.139.
Deny from 54.234.158.
Deny from 54.227.139.
#BUbiNG Has Multiple Static IP: 217.73.208.XXX/159.149.133.XXX
Deny from 217.73.208.
Deny from 159.149.133.
#James BOT Has Multiple Static IP: 188.40.97.XXX/188.40.120.XXX
Deny from 188.40.97.
Deny from 188.40.120.
Allow from all
################################################################################
################ Ban Bad/Evil Bot/Crawler/Spider Using User-Agent ##############
################################################################################
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_USER_AGENT} spbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} libwww-perl [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} DotBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Sogou-Test-Spider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ia_archiver [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} agbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} GeoHasher [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} TurnitinBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} JikeSpider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} voilabot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Sosospider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Wayback [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} 80legs [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} coccoc [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YodaoBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Exabot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Nutch [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} DigExt [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} mgmt\ mic [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SeznamBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} discoverybot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} MJ12bot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SearchmetricsBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SEOstats [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} GrapeshotCrawler [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YandexBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} meanpathbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YYSpider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Yeti [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} MyNutchTest [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CareerBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Wotbox [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} A6-Indexer [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} sogou [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} seoresearch [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} accelobot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Alcohol\ Search [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebMoney\ Advisor [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} news\ bot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} evuln.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} r-e-f-e-r-e-r.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} aboutthedomain [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Zeus [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} larbin [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BlackWidow [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Custo [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} DISCo [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Download\ Demon [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} eCatch [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EirGrabber [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EmailSiphon [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EmailWolf [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Express\ WebPictures [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ExtractorPro [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EyeNetIE [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} FlashGet [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} GetRight [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Go-Ahead-Got-It [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} GrabNet [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Grafula [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} HMView [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Image\ Stripper [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Image\ Sucker [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} InterGET [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Internet\ Ninja [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} JetCar [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} JOC\ Web\ Spider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} libghttp [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} LeechFTP [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Mass\ Downloader [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} MIDown\ tool [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Missigua [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Mister\ PiX [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Navroad [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NearSite [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NetAnts [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NetSpider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Net\ Vampire [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NetZIP [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} PageGrabber [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Papa\ Foto [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} pavuk [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} RealDownload [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ReGet [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SiteSnagger [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SmartDownload [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SuperBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SuperHTTP [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Surfbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} tAkeOut [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Teleport\ Pro [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} VoidEYE [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Web\ Image\ Collector [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Web\ Sucker [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebAuto [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebCopier [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebFetch [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebGo\ IS [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebLeacher [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebReaper [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebSauger [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Website\ eXtractor [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Website\ Quester [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebStripper [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebWhacker [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebZIP [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WWWOFFLE [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Alexibot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Anonymouse.org [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} asterias [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BackDoorBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BackWeb [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Bigfoot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Black\ Hole [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BlowFish [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BotALot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Buddy [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BuiltBotTough [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Bullseye [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BunnySlippers [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Cegbfeieh [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CheeseBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CherryPicker [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Collector [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Copier [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CopyRightCheck [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} cosmos [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Crescent [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} DIIbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} DittoSpyder [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Download\ Demon [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Download\ Devil [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Download\ Wonder [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} dragonfly [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Drip [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EasyDL [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ebingbong [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EmailCollector [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EroCrawler [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} FileHound [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Harvest [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} IlseBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} InfoNaviRobot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} InfoTekies [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Iria [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Jakarta [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Jyxobot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Kenjin\ Spider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Keyword\ Density [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NAMEPROTECT [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NimbleCrawler [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} OutfoxBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Xenu [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WISENutbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Zyborg [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} tab.search.daum.net [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Web\ Image\ Collector [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WWW-Collector-E [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} sitecheck.internetseer.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YisouSpider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} linkdexbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Add\ Catalog [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ChinaClaw [NC]
  RewriteCond %{HTTP_USER_AGENT} CrystalSemanticsBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ContextAd\ Bot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} grapeFX [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SISTRIX\ Crawler [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} AhrefsBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Ezooms [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Baiduspider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BLEXBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BUbiNG [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} James\ BOT [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Aboundex [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Aboundexbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} AcoonBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} aiHitBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} EC2LinkFinder [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} InfoPath [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ip-web-crawler.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Mail.Ru [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} MixrankBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} netEstate\ NE\ Crawler [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NextGenSearchBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} panscient.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} psbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Searchmetrics [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} sitebot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} swebot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} taptubot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} TwengaBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} twiceler [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} URLAppendBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} vscooter [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WBSearchBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SiteExplorer [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Sogou\ web\ spider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} IstellaBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} www.integromedb.org [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Abonti [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ZmEu [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Morfeus [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Snoopy [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} 360Spider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YamanaLab-Robot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} linkcheck [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} lipperhey [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} dataprovider.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SemrushBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} purebot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} aipbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} becomebot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Bookmark\ search\ tool [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} BotRightHere [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Copernic [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Crescent\ Internet\ ToolPak\ HTTP\ OLE\ Control\  v.1.0 [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} FairAd\ Client [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Fasterfox [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Flaming\ AttackBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Foobot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} gigabot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Gaisbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} hloader [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} httplib [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} humanlinks [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Iron33 [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} JennyBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} LexiBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} libWeb/clsHTTP [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} LinkextractorPro [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} LinkScan/8.1a Unix [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} LinkWalker [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} LNSpiderguy [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} lwp-trivial [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Mata Hari [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} MIIxpc [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} NICErsPRO [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Openbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Openfind [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Openfind\ data\ gatherer [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Oracle\ Ultra\ Search [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} PerMan [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ProPowerBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ProWebWalker [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} QueryN\ Metasearch [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Radiation\ Retriever [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} RepoMonkey [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} RMA [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} rogerbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SpankBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} spanner [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} SurveyBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} suzuran [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Szukacz [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} TeleportPro [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Telesoft [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} The\ Intraformant [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} TheNomad [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} TightTwatBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} toCrawl [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} True_Robot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} turingos [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} TurnitinBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} URL_Spider_Pro [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebBandit [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebCapture [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebCopier [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} WebEnhancer [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Webster\ Pro [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Roverbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} 008 [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} http://www.analyticsseo.com [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CloudACL [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YoudaoBot [NC]
  RewriteRule .* - [F]
</IfModule>
################################################################################
############################### Maintenance Rules ##############################
################################################################################
#<IfModule mod_rewrite.c>
#  RewriteEngine On
#  RewriteCond %{REMOTE_HOST} !^151\.52\.223\.235
#  RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
#  RewriteCond %{REQUEST_URI} !/err/503\.php$ [NC]
#  RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
#  RewriteRule .* /err/503\.php [R=302,L]
#</IfModule>
4

1 回答 1

0

抱歉,经过一些测试,我可以说 RewriteCond 对我来说没有诀窍,所以我决定使用另一个 escamotage,mod_setenvif,它更准确并且匹配所有字符串/正则表达式规则。这段代码可以被认为是最终模型。如果您想添加更多注释,欢迎您。我看到的是 RewriteCond 在某些情况下会失败,而 SetEnvIfNoCase 确实没有问题。

################################################################################
############################### Custom Error Pages #############################
################################################################################
ErrorDocument 401 /err/401.php
ErrorDocument 403 /err/403.php
ErrorDocument 404 /err/404.php
ErrorDocument 500 /err/500.php
ErrorDocument 503 /err/503.php
ErrorDocument 504 /err/504.php
################################################################################
################################ Redirect Requests #############################
################################################################################
RedirectMatch /eml/a71mail.php /eml/mail.php
RedirectMatch /files/Alecos-280507.jpg /img/Immagine.jpg
RedirectMatch /img/Ak71_05.jpg /img/Immagine.jpg
################################################################################
################ Ban Bad/Evil Bot/Crawler/Spider Using User-Agent ##############
################################################################################
SetEnvIfNoCase User-Agent spbot evil_bot
SetEnvIfNoCase User-Agent libwww-perl evil_bot
SetEnvIfNoCase User-Agent DotBot evil_bot
SetEnvIfNoCase User-Agent Sogou-Test-Spider evil_bot
SetEnvIfNoCase User-Agent ia_archiver evil_bot
SetEnvIfNoCase User-Agent agbot evil_bot
SetEnvIfNoCase User-Agent GeoHasher evil_bot
SetEnvIfNoCase User-Agent TurnitinBot evil_bot
SetEnvIfNoCase User-Agent JikeSpider evil_bot
SetEnvIfNoCase User-Agent voilabot evil_bot
SetEnvIfNoCase User-Agent Sosospider evil_bot
SetEnvIfNoCase User-Agent Wayback evil_bot
SetEnvIfNoCase User-Agent 80legs evil_bot
SetEnvIfNoCase User-Agent coccoc evil_bot
SetEnvIfNoCase User-Agent YodaoBot evil_bot
SetEnvIfNoCase User-Agent Exabot evil_bot
SetEnvIfNoCase User-Agent Nutch evil_bot
SetEnvIfNoCase User-Agent DigExt evil_bot
SetEnvIfNoCase User-Agent SeznamBot evil_bot
SetEnvIfNoCase User-Agent discoverybot evil_bot
SetEnvIfNoCase User-Agent MJ12bot evil_bot
SetEnvIfNoCase User-Agent SearchmetricsBot evil_bot
SetEnvIfNoCase User-Agent SEOstats evil_bot
SetEnvIfNoCase User-Agent GrapeshotCrawler evil_bot
SetEnvIfNoCase User-Agent YandexBot evil_bot
SetEnvIfNoCase User-Agent meanpathbot evil_bot
SetEnvIfNoCase User-Agent YYSpider evil_bot
SetEnvIfNoCase User-Agent Yeti evil_bot
SetEnvIfNoCase User-Agent MyNutchTest evil_bot
SetEnvIfNoCase User-Agent CareerBot evil_bot
SetEnvIfNoCase User-Agent Wotbox evil_bot
SetEnvIfNoCase User-Agent A6-Indexer evil_bot
SetEnvIfNoCase User-Agent sogou evil_bot
SetEnvIfNoCase User-Agent seoresearch evil_bot
SetEnvIfNoCase User-Agent accelobot evil_bot
SetEnvIfNoCase User-Agent Alcohol evil_bot
SetEnvIfNoCase User-Agent WebMoney evil_bot
SetEnvIfNoCase User-Agent evuln.com evil_bot
SetEnvIfNoCase User-Agent r-e-f-e-r-e-r.com evil_bot
SetEnvIfNoCase User-Agent aboutthedomain evil_bot
SetEnvIfNoCase User-Agent Zeus evil_bot
SetEnvIfNoCase User-Agent larbin evil_bot
SetEnvIfNoCase User-Agent BlackWidow evil_bot
SetEnvIfNoCase User-Agent Custo evil_bot
SetEnvIfNoCase User-Agent DISCo evil_bot
SetEnvIfNoCase User-Agent eCatch evil_bot
SetEnvIfNoCase User-Agent EirGrabber evil_bot
SetEnvIfNoCase User-Agent EmailSiphon evil_bot
SetEnvIfNoCase User-Agent EmailWolf evil_bot
SetEnvIfNoCase User-Agent WebPictures evil_bot
SetEnvIfNoCase User-Agent ExtractorPro evil_bot
SetEnvIfNoCase User-Agent EyeNetIE evil_bot
SetEnvIfNoCase User-Agent FlashGet evil_bot
SetEnvIfNoCase User-Agent GetRight evil_bot
SetEnvIfNoCase User-Agent Go-Ahead-Got-It evil_bot
SetEnvIfNoCase User-Agent GrabNet evil_bot
SetEnvIfNoCase User-Agent Grafula evil_bot
SetEnvIfNoCase User-Agent HMView evil_bot
SetEnvIfNoCase User-Agent Stripper evil_bot
SetEnvIfNoCase User-Agent Sucker evil_bot
SetEnvIfNoCase User-Agent InterGET evil_bot
SetEnvIfNoCase User-Agent Ninja evil_bot
SetEnvIfNoCase User-Agent JetCar evil_bot
SetEnvIfNoCase User-Agent Spider evil_bot
SetEnvIfNoCase User-Agent libghttp evil_bot
SetEnvIfNoCase User-Agent LeechFTP evil_bot
SetEnvIfNoCase User-Agent Downloader evil_bot
SetEnvIfNoCase User-Agent MIDown evil_bot
SetEnvIfNoCase User-Agent Missigua evil_bot
SetEnvIfNoCase User-Agent Mister evil_bot
SetEnvIfNoCase User-Agent Navroad evil_bot
SetEnvIfNoCase User-Agent NearSite evil_bot
SetEnvIfNoCase User-Agent NetAnts evil_bot
SetEnvIfNoCase User-Agent NetSpider evil_bot
SetEnvIfNoCase User-Agent Vampire evil_bot
SetEnvIfNoCase User-Agent NetZIP evil_bot
SetEnvIfNoCase User-Agent PageGrabber evil_bot
SetEnvIfNoCase User-Agent Papa evil_bot
SetEnvIfNoCase User-Agent pavuk evil_bot
SetEnvIfNoCase User-Agent RealDownload evil_bot
SetEnvIfNoCase User-Agent ReGet evil_bot
SetEnvIfNoCase User-Agent SiteSnagger evil_bot
SetEnvIfNoCase User-Agent SmartDownload evil_bot
SetEnvIfNoCase User-Agent SuperBot evil_bot
SetEnvIfNoCase User-Agent SuperHTTP evil_bot
SetEnvIfNoCase User-Agent Surfbot evil_bot
SetEnvIfNoCase User-Agent tAkeOut evil_bot
SetEnvIfNoCase User-Agent Teleport evil_bot
SetEnvIfNoCase User-Agent VoidEYE evil_bot
SetEnvIfNoCase User-Agent WebAuto evil_bot
SetEnvIfNoCase User-Agent WebCopier evil_bot
SetEnvIfNoCase User-Agent WebFetch evil_bot
SetEnvIfNoCase User-Agent WebGo evil_bot
SetEnvIfNoCase User-Agent WebLeacher evil_bot
SetEnvIfNoCase User-Agent WebReaper evil_bot
SetEnvIfNoCase User-Agent WebSauger evil_bot
SetEnvIfNoCase User-Agent eXtractor evil_bot
SetEnvIfNoCase User-Agent Quester evil_bot
SetEnvIfNoCase User-Agent WebStripper evil_bot
SetEnvIfNoCase User-Agent WebWhacker evil_bot
SetEnvIfNoCase User-Agent WebZIP evil_bot
SetEnvIfNoCase User-Agent WWWOFFLE evil_bot
SetEnvIfNoCase User-Agent Alexibot evil_bot
SetEnvIfNoCase User-Agent Anonymouse.org evil_bot
SetEnvIfNoCase User-Agent asterias evil_bot
SetEnvIfNoCase User-Agent BackDoorBot evil_bot
SetEnvIfNoCase User-Agent BackWeb evil_bot
SetEnvIfNoCase User-Agent Bigfoot evil_bot
SetEnvIfNoCase User-Agent Hole evil_bot
SetEnvIfNoCase User-Agent BlowFish evil_bot
SetEnvIfNoCase User-Agent BotALot evil_bot
SetEnvIfNoCase User-Agent Buddy evil_bot
SetEnvIfNoCase User-Agent BuiltBotTough evil_bot
SetEnvIfNoCase User-Agent Bullseye evil_bot
SetEnvIfNoCase User-Agent BunnySlippers evil_bot
SetEnvIfNoCase User-Agent Cegbfeieh evil_bot
SetEnvIfNoCase User-Agent CheeseBot evil_bot
SetEnvIfNoCase User-Agent CherryPicker evil_bot
SetEnvIfNoCase User-Agent Collector evil_bot
SetEnvIfNoCase User-Agent Copier evil_bot
SetEnvIfNoCase User-Agent CopyRightCheck evil_bot
SetEnvIfNoCase User-Agent cosmos evil_bot
SetEnvIfNoCase User-Agent Crescent evil_bot
SetEnvIfNoCase User-Agent DIIbot evil_bot
SetEnvIfNoCase User-Agent DittoSpyder evil_bot
SetEnvIfNoCase User-Agent Demon evil_bot
SetEnvIfNoCase User-Agent Devil evil_bot
SetEnvIfNoCase User-Agent Wonder evil_bot
SetEnvIfNoCase User-Agent dragonfly evil_bot
SetEnvIfNoCase User-Agent Drip evil_bot
SetEnvIfNoCase User-Agent EasyDL evil_bot
SetEnvIfNoCase User-Agent ebingbong evil_bot
SetEnvIfNoCase User-Agent EmailCollector evil_bot
SetEnvIfNoCase User-Agent EroCrawler evil_bot
SetEnvIfNoCase User-Agent FileHound evil_bot
SetEnvIfNoCase User-Agent Harvest evil_bot
SetEnvIfNoCase User-Agent IlseBot evil_bot
SetEnvIfNoCase User-Agent InfoNaviRobot evil_bot
SetEnvIfNoCase User-Agent InfoTekies evil_bot
SetEnvIfNoCase User-Agent Iria evil_bot
SetEnvIfNoCase User-Agent Jakarta evil_bot
SetEnvIfNoCase User-Agent Jyxobot evil_bot
SetEnvIfNoCase User-Agent Kenjin evil_bot
SetEnvIfNoCase User-Agent Density evil_bot
SetEnvIfNoCase User-Agent NAMEPROTECT evil_bot
SetEnvIfNoCase User-Agent NimbleCrawler evil_bot
SetEnvIfNoCase User-Agent OutfoxBot evil_bot
SetEnvIfNoCase User-Agent Xenu evil_bot
SetEnvIfNoCase User-Agent WISENutbot evil_bot
SetEnvIfNoCase User-Agent Zyborg evil_bot
SetEnvIfNoCase User-Agent tab.search.daum.net evil_bot
SetEnvIfNoCase User-Agent WWW-Collector-E evil_bot
SetEnvIfNoCase User-Agent sitecheck.internetseer.com evil_bot
SetEnvIfNoCase User-Agent YisouSpider evil_bot
SetEnvIfNoCase User-Agent linkdexbot evil_bot
SetEnvIfNoCase User-Agent ChinaClaw evil_bot
SetEnvIfNoCase User-Agent CrystalSemanticsBot evil_bot
SetEnvIfNoCase User-Agent ContextAd evil_bot
SetEnvIfNoCase User-Agent grapeFX evil_bot
SetEnvIfNoCase User-Agent SISTRIX evil_bot
SetEnvIfNoCase User-Agent AhrefsBot evil_bot
SetEnvIfNoCase User-Agent Ezooms evil_bot
SetEnvIfNoCase User-Agent Baiduspider evil_bot
SetEnvIfNoCase User-Agent BLEXBot evil_bot
SetEnvIfNoCase User-Agent BUbiNG evil_bot
SetEnvIfNoCase User-Agent James evil_bot
SetEnvIfNoCase User-Agent Aboundex evil_bot
SetEnvIfNoCase User-Agent Aboundexbot evil_bot
SetEnvIfNoCase User-Agent AcoonBot evil_bot
SetEnvIfNoCase User-Agent aiHitBot evil_bot
SetEnvIfNoCase User-Agent EC2LinkFinder evil_bot
SetEnvIfNoCase User-Agent InfoPath evil_bot
SetEnvIfNoCase User-Agent ip-web-crawler.com evil_bot
SetEnvIfNoCase User-Agent Mail.Ru evil_bot
SetEnvIfNoCase User-Agent MixrankBot evil_bot
SetEnvIfNoCase User-Agent netEstate evil_bot
SetEnvIfNoCase User-Agent NextGenSearchBot evil_bot
SetEnvIfNoCase User-Agent panscient.com evil_bot
SetEnvIfNoCase User-Agent psbot evil_bot
SetEnvIfNoCase User-Agent Searchmetrics evil_bot
SetEnvIfNoCase User-Agent sitebot evil_bot
SetEnvIfNoCase User-Agent swebot evil_bot
SetEnvIfNoCase User-Agent taptubot evil_bot
SetEnvIfNoCase User-Agent TwengaBot evil_bot
SetEnvIfNoCase User-Agent twiceler evil_bot
SetEnvIfNoCase User-Agent URLAppendBot evil_bot
SetEnvIfNoCase User-Agent vscooter evil_bot
SetEnvIfNoCase User-Agent WBSearchBot evil_bot
SetEnvIfNoCase User-Agent SiteExplorer evil_bot
SetEnvIfNoCase User-Agent Sogou evil_bot
SetEnvIfNoCase User-Agent IstellaBot evil_bot
SetEnvIfNoCase User-Agent www.integromedb.org evil_bot
SetEnvIfNoCase User-Agent Abonti evil_bot
SetEnvIfNoCase User-Agent ZmEu evil_bot
SetEnvIfNoCase User-Agent Morfeus evil_bot
SetEnvIfNoCase User-Agent Snoopy evil_bot
SetEnvIfNoCase User-Agent 360Spider evil_bot
SetEnvIfNoCase User-Agent YamanaLab-Robot evil_bot
SetEnvIfNoCase User-Agent linkcheck evil_bot
SetEnvIfNoCase User-Agent lipperhey evil_bot
SetEnvIfNoCase User-Agent dataprovider.com evil_bot
SetEnvIfNoCase User-Agent SemrushBot evil_bot
SetEnvIfNoCase User-Agent purebot evil_bot
SetEnvIfNoCase User-Agent aipbot evil_bot
SetEnvIfNoCase User-Agent becomebot evil_bot
SetEnvIfNoCase User-Agent BotRightHere evil_bot
SetEnvIfNoCase User-Agent CherryPickerElite evil_bot
SetEnvIfNoCase User-Agent CherryPickerSE evil_bot
SetEnvIfNoCase User-Agent Copernic evil_bot
SetEnvIfNoCase User-Agent FairAd evil_bot
SetEnvIfNoCase User-Agent Fasterfox evil_bot
SetEnvIfNoCase User-Agent Flaming evil_bot
SetEnvIfNoCase User-Agent AttackBot evil_bot
SetEnvIfNoCase User-Agent Foobot evil_bot
SetEnvIfNoCase User-Agent gigabot evil_bot
SetEnvIfNoCase User-Agent Gaisbot evil_bot
SetEnvIfNoCase User-Agent hloader evil_bot
SetEnvIfNoCase User-Agent httplib evil_bot
SetEnvIfNoCase User-Agent HTTrack evil_bot
SetEnvIfNoCase User-Agent humanlinks evil_bot  
SetEnvIfNoCase User-Agent Iron33 evil_bot
SetEnvIfNoCase User-Agent JennyBot evil_bot
SetEnvIfNoCase User-Agent LexiBot evil_bot
SetEnvIfNoCase User-Agent libWeb/clsHTTP evil_bot
SetEnvIfNoCase User-Agent LinkextractorPro evil_bot
SetEnvIfNoCase User-Agent LinkWalker evil_bot
SetEnvIfNoCase User-Agent LNSpiderguy evil_bot
SetEnvIfNoCase User-Agent lwp-trivial evil_bot  
SetEnvIfNoCase User-Agent MIIxpc evil_bot
SetEnvIfNoCase User-Agent NICErsPRO evil_bot
SetEnvIfNoCase User-Agent Openbot evil_bot
SetEnvIfNoCase User-Agent Openfind evil_bot
SetEnvIfNoCase User-Agent gatherer evil_bot
SetEnvIfNoCase User-Agent Oracle evil_bot
SetEnvIfNoCase User-Agent PerMan evil_bot
SetEnvIfNoCase User-Agent ProPowerBot evil_bot
SetEnvIfNoCase User-Agent ProWebWalker evil_bot
SetEnvIfNoCase User-Agent QueryN evil_bot
SetEnvIfNoCase User-Agent Metasearch evil_bot
SetEnvIfNoCase User-Agent Radiation evil_bot
SetEnvIfNoCase User-Agent Retriever evil_bot
SetEnvIfNoCase User-Agent RepoMonkey evil_bot
SetEnvIfNoCase User-Agent RMA evil_bot
SetEnvIfNoCase User-Agent rogerbot evil_bot
SetEnvIfNoCase User-Agent SpankBot evil_bot
SetEnvIfNoCase User-Agent spanner evil_bot
SetEnvIfNoCase User-Agent SurveyBot evil_bot
SetEnvIfNoCase User-Agent suzuran evil_bot
SetEnvIfNoCase User-Agent Szukacz evil_bot
SetEnvIfNoCase User-Agent TeleportPro evil_bot
SetEnvIfNoCase User-Agent Telesoft evil_bot
SetEnvIfNoCase User-Agent Intraformant evil_bot
SetEnvIfNoCase User-Agent TheNomad evil_bot
SetEnvIfNoCase User-Agent TightTwatBot evil_bot
SetEnvIfNoCase User-Agent toCrawl evil_bot
SetEnvIfNoCase User-Agent True_Robot evil_bot
SetEnvIfNoCase User-Agent turingos evil_bot
SetEnvIfNoCase User-Agent TurnitinBot evil_bot
SetEnvIfNoCase User-Agent URL_Spider_Pro evil_bot
SetEnvIfNoCase User-Agent WebBandit evil_bot
SetEnvIfNoCase User-Agent WebCapture evil_bot
SetEnvIfNoCase User-Agent WebEnhancer evil_bot
SetEnvIfNoCase User-Agent Webster evil_bot
SetEnvIfNoCase User-Agent Roverbot evil_bot
SetEnvIfNoCase User-Agent 008 evil_bot
SetEnvIfNoCase User-Agent http://www.analyticsseo.com evil_bot
SetEnvIfNoCase User-Agent CloudACL evil_bot
SetEnvIfNoCase User-Agent LinkScan evil_bot
SetEnvIfNoCase User-Agent Mata evil_bot
SetEnvIfNoCase User-Agent Hari evil_bot
SetEnvIfNoCase User-Agent ips-agent evil_bot
SetEnvIfNoCase User-Agent DTS evil_bot
SetEnvIfNoCase User-Agent Agent evil_bot
SetEnvIfNoCase User-Agent YoudaoBot evil_bot
################################################################################
#################### Ban Bad/Evil Bot/Crawler/Spider Using IP ##################
################################################################################
Order Allow,Deny
Deny from env=evil_bot
#SpamBot, Try Ban Bad/Evil IP Address
Deny from 79.142.68.99
Deny from 91.201.66.76
Deny from 46.137.10.92
Deny from 212.156.58.182
Deny from 109.230.216.60
Deny from 176.31.122.216
Deny from 37.187.71.183
Deny from 37.187.89.129
Deny from 78.46.105.91
Deny from 74.95.0.186
Deny from 117.78.13.17
Deny from 12.232.58.137
Deny from 85.214.219.253
Allow from all
################################################################################
############################### Maintenance Rules ##############################
################################################################################
#<IfModule mod_rewrite.c>
#  RewriteEngine On
#  RewriteCond %{REMOTE_HOST} !^151\.52\.223\.235
#  RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
#  RewriteCond %{REQUEST_URI} !/err/503\.php$ [NC]
#  RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
#  RewriteRule .* /err/503\.php [R=302,L]
#</IfModule>

通过使用以下规则将文件 .htaccess 放入 err/ 文件夹来解决 ErrorDocument:

Order Deny,Allow
Allow from all

就是这样,玩得开心!

于 2013-10-21T13:06:32.237 回答