Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [.htaccess] Problem z blokowaniem robotów
Przekras
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 24.06.2014

Ostrzeżenie: (0%)
-----


Witam,
chciałem dodać do swojej strony blokowanie niektórych robotów, na jednej ze stron znalazłem listę robotów i dodałem kilka swoich(lista jest dłuższa niż na dole). Przed zmianami plik .htaccess wyglądał tak (wszystko dobrze działało, a czy wydajnie to nie wiem):

  1. RewriteEngine On
  2. RewriteCond %{HTTP_HOST} ^strona.com$ [NC]
  3. RewriteRule ^(.*)$ http://www.strona.com/$1 [R=301,L]
  4. RewriteBase /
  5. RewriteCond %{REQUEST_URI} ^/index.php$
  6. RewriteCond %{QUERY_STRING} ^$
  7. RewriteRule ^(.*)$ http://www.strona.com/$ [R=301,L]
  8. RewriteRule ^rss.xml$ /rss.php [L]
  9. RewriteRule ^sitemap.xml$ /sitemap.php [L]
  10. RewriteRule ^([a-zA-Z0-9-]+)/$ http://%{HTTP_HOST}/$1 [R=301]
  11. RewriteRule ^site-([0-9]+)$ index.php?page=$1 [L,NC]
  12. RewriteRule ^([a-z-]+)$ index.php?aba=$1 [L,NC]
  13. RewriteRule ^([a-z-]+)/([a-zA-Z0-9-]+)/$ http://%{HTTP_HOST}/$1/$2 [R=301]
  14. RewriteRule ^([a-z-]+)/site-([0-9]+)$ index.php?aba=$1&page=$2 [L,NC]
  15. RewriteRule ^([a-z-]+)/([0-9]+)/([^*]+)/$ http://%{HTTP_HOST}/$1/$2/$3 [R=301]
  16. RewriteRule ^([a-z-]+)/([0-9]+)/([^*]+)$ index.php?aba=$1&id=$2&titleurl=$3 [L,NC]
  17. RewriteRule ^([a-z-]+)/([a-zA-Z0-9-]+)/([a-z-]+)/([a-zA-Z0-9-]+)/$ http://%{HTTP_HOST}/$1/$2/$3/$4 [R=301]
  18. RewriteRule ^([a-z-]+)/([a-zA-Z0-9-]+)/([a-z-]+)/site-([0-9]+)$ index.php?aba=$1&category=$2&titleurl=$3&page=$4 [L,NC]
  19. ErrorDocument 404 http://www.strona.com/
  20. ErrorDocument 403 http://www.strona.com/


Zmieniłem na taki:

  1. RewriteEngine On
  2. RewriteCond %{HTTP_HOST} ^strona.com$ [NC]
  3. RewriteRule ^(.*)$ http://www.strona.com/$1 [R=301,L]
  4. RewriteBase /
  5. RewriteCond %{REQUEST_URI} ^/index.php$
  6. RewriteCond %{QUERY_STRING} ^$
  7. RewriteRule ^(.*)$ http://www.strona.com/$ [R=301,L]
  8. RewriteRule ^rss.xml$ /rss.php [L]
  9. RewriteRule ^sitemap.xml$ /sitemap.php [L]
  10. RewriteRule ^([a-zA-Z0-9-]+)/$ http://%{HTTP_HOST}/$1 [R=301]
  11. RewriteRule ^site-([0-9]+)$ index.php?page=$1 [L,NC]
  12. RewriteRule ^([a-z-]+)$ index.php?aba=$1 [L,NC]
  13. RewriteRule ^([a-z-]+)/([a-zA-Z0-9-]+)/$ http://%{HTTP_HOST}/$1/$2 [R=301]
  14. RewriteRule ^([a-z-]+)/site-([0-9]+)$ index.php?aba=$1&page=$2 [L,NC]
  15. RewriteRule ^([a-z-]+)/([0-9]+)/([^*]+)/$ http://%{HTTP_HOST}/$1/$2/$3 [R=301]
  16. RewriteRule ^([a-z-]+)/([0-9]+)/([^*]+)$ index.php?aba=$1&id=$2&titleurl=$3 [L,NC]
  17. RewriteRule ^([a-z-]+)/([a-zA-Z0-9-]+)/([a-z-]+)/([a-zA-Z0-9-]+)/$ http://%{HTTP_HOST}/$1/$2/$3/$4 [R=301]
  18. RewriteRule ^([a-z-]+)/([a-zA-Z0-9-]+)/([a-z-]+)/site-([0-9]+)$ index.php?aba=$1&category=$2&titleurl=$3&page=$4 [L,NC]
  19. ## SITE REFERRER BANNING
  20. RewriteCond %{HTTP_REFERER} Traffic2cash.xyz [NC,OR]
  21. RewriteCond %{HTTP_REFERER} Share-buttons.xyz [NC]
  22. RewriteRule .* - [F]
  23. ## Bad bot
  24. SetEnvIfNoCase User-Agent "abot" bad_bot
  25. SetEnvIfNoCase User-Agent "AhrefsBot" bad_bot
  26. SetEnvIfNoCase User-Agent "aipbot" bad_bot
  27. SetEnvIfNoCase User-Agent "asterias" bad_bot
  28. SetEnvIfNoCase User-Agent "bingbot" bad_bot
  29. SetEnvIfNoCase User-Agent "EI" bad_bot
  30. SetEnvIfNoCase User-Agent "Blogshares Spiders" bad_bot
  31. SetEnvIfNoCase User-Agent "Board Bot" bad_bot
  32. SetEnvIfNoCase User-Agent "Board Bot" bad_bot
  33. SetEnvIfNoCase User-Agent "Convera" bad_bot
  34. SetEnvIfNoCase User-Agent "ConveraMultiMediaCrawler" bad_bot
  35. SetEnvIfNoCase User-Agent "c-spider" bad_bot
  36. SetEnvIfNoCase User-Agent "Yandex" bad_bot
  37. SetEnvIfNoCase User-Agent "YandexBot" bad_bot
  38. SetEnvIfNoCase User-Agent "zerxbot" bad_bot
  39. # Apache < 2.4
  40. <IfModule !mod_authz_core.c>
  41. <Limit GET POST>
  42. Order allow,deny
  43. Allow from all
  44. Deny from env=bad_bot
  45. </Limit>
  46. </IfModule>
  47. # Apache >= 2.4
  48. <IfModule mod_authz_core.c>
  49. <Limit GET POST>
  50. <RequireAll>
  51. Require all granted
  52. Require not env bad_bot
  53. </RequireAll>
  54. </Limit>
  55. </IfModule>
  56. ErrorDocument 404 http://www.strona.com/
  57. ErrorDocument 403 http://www.strona.com/


Po zmianie roboty nie są blokowane (sprawdziłem w logach). Nie znam się za bardzo na plikach .htaccess, co mogę zmienić żeby to działało i miało dobrą wydajność?


Ten post edytował Przekras 11.01.2016, 22:35:42
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 26.08.2025 - 21:35