Codice per scrivere il passaggio dello spider
-
Ho una funzione sche scrive su file quando passano i vari bot:
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Googlebot')){$bot='Googlebot';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mediapartners')){$bot='Adsense';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Slurp')){$bot='Hot Bot';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'ichiro')){$bot='ichiro';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'msnbot')){$str_bot='Msn';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'bingBot')){$str_bot='Bing';}Il guaio è che funziona a dovere von googlebot o ichiro, ma fallisce se invece il bon è bingbot o msnbot.
A cosa può essere dovuto questo strano comportamento?
Grazie -
Prova a usare stristr() .
-
-
netgreg
Ho una funzione sche scrive su file quando passano i vari bot:
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Googlebot')){$bot='Googlebot';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mediapartners')){$bot='Adsense';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Slurp')){$bot='Hot Bot';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'ichiro')){$bot='ichiro';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'msnbot')){$str_bot='Msn';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'bingBot')){$str_bot='Bing';}Il guaio è che funziona a dovere von googlebot o ichiro, ma fallisce se invece il bon è bingbot o msnbot.
A cosa può essere dovuto questo strano comportamento?
GrazieCon gli spider sono più diretto di te

<Location /> SetEnvIf User-Agent "msnbot" BlockUA SetEnvIf User-Agent "bingbot" BlockUA SetEnvIf User-Agent "Googlebot" BlockUA SetEnvIf User-Agent "Mediapartners" BlockUA SetEnvIf User-Agent "Slurp" BlockUA SetEnvIf User-Agent "Ikiro" BlockUA Order allow,deny Allow from all Deny from env=BlockUA </Location>Li chiudo fuori della porta a ciao ciao. Grazie a dio esiste Apache
-
-
netgreg
Grazie Aragonese,
avevo provato un codice simile a qualo consigliato da te, ma non sono riuscito a farlo funzionare. Era diverso, non a veva il tag location.
Ma spiegami meglio: va messo in htaccess, vero?apache.conf
-
Ho gia risposto ma non vedo nulla, riscrivo.
Non credo che il mio hoster mi faccia toccare quel file, penso che oltre htaccess non mi lasci andare.
Ad oggi ho provato vari per rendere il sito invisibile a vari bot, ma son riuscito sono con Deny Num_ip. Se il bot cambia ip... non funziona piu.
Inoltre il server ho notato che risponde in modo strano: prima 301 e subito dopo 401.
Senza contare che una volta in mezzo a due 401 ha risposto con un 200!Se non posso rendere il sito invisibile almeno redirigere le richieste ad un sito inesistente, come il codice sotto, che non va:
#sbarazziamoci dei bot
RewriteCond %{HTTP_USER_AGENT} ^BadBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^scoutjet [OR]
RewriteCond %{HTTP_USER_AGENT} ^woopingbot
RewriteRule ^(.)$ http: //go.away/
#RewriteRule ^.$ http: //127.0.0.1 [R,L] -
netgreg
Ho gia risposto ma non vedo nulla, riscrivo.
Non credo che il mio hoster mi faccia toccare quel file, penso che oltre htaccess non mi lasci andare.
Ad oggi ho provato vari per rendere il sito invisibile a vari bot, ma son riuscito sono con Deny Num_ip. Se il bot cambia ip... non funziona piu.
Inoltre il server ho notato che risponde in modo strano: prima 301 e subito dopo 401.
Senza contare che una volta in mezzo a due 401 ha risposto con un 200!Se non posso rendere il sito invisibile almeno redirigere le richieste ad un sito inesistente, come il codice sotto, che non va:
#sbarazziamoci dei bot
RewriteCond %{HTTP_USER_AGENT} ^BadBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^scoutjet [OR]
RewriteCond %{HTTP_USER_AGENT} ^woopingbot
RewriteRule ^(.)$ http: //go.away/
#RewriteRule ^.$ http: //127.0.0.1 [R,L]Ti manca il mod_rewrite
-
Aragonesse
Ti manca il mod_rewrite
Sembra che il modulo sia presente, perchè queste due righe di codice, molto simili, funzionano bene:
la prox riga redirect da senza www a con www
RewriteCond %{HTTP_HOST} ^xprenotare.it [NC]
RewriteRule ^(.*)$ www xprenotare.it/$1 [R=301,L] -
netgreg
Sembra che il modulo sia presente, perchè queste due righe di codice, molto simili, funzionano bene:
la prox riga redirect da senza www a con www
RewriteCond %{HTTP_HOST} ^xprenotare.it [NC]
RewriteRule ^(.*)$ www xprenotare.it/$1 [R=301,L]RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:[email protected] [OR] RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR] RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR] RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR] RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR] RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR] RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR] RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR] RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR] RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR] RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR] RewriteCond %{HTTP_USER_AGENT} ^HMView [OR] RewriteCond %{HTTP_USER_AGENT} ^HTTrack [OR] RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR] RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR] RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR] RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR] RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR] RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR] RewriteCond %{HTTP_USER_AGENT} ^larbin [OR] RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR] RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR] RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR] RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR] RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR] RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR] RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR] RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR] RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR] RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR] RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR] RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR] RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR] RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR] RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR] RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR] RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR] RewriteCond %{HTTP_USER_AGENT} ^Siphon [OR] RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR] RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR] RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR] RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR] RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR] RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR] RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR] RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR] RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR] RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR] RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR] RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR] RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR] RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR] RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR] RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR] RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR] RewriteCond %{HTTP_USER_AGENT} ^Wget [OR] RewriteCond %{HTTP_USER_AGENT} ^Widow [OR] RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR] RewriteCond %{HTTP_USER_AGENT} ^Zeus RewriteRule ^.*$ [B]METTI QUA QUELLO CHE VUOI [/B][L,R]Prova questo
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi