tamanmerah

Htaccess terbaru oke

Nov 5th, 2026
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. # -----------------------------------------
  2. # Block bots, spiders, crawlers (Kecuali Facebook)
  3. # -----------------------------------------
  4. <IfModule mod_rewrite.c>
  5. RewriteEngine On
  6.  
  7. # Jangan blokir bot Facebook / Meta
  8. RewriteCond %{HTTP_USER_AGENT} (?i)(facebookexternalhit|facebot|meta-externalagent) [NC]
  9. RewriteRule .* - [L]
  10.  
  11. # Cek User-Agent untuk bot umum (selain Facebook)
  12. RewriteCond %{HTTP_USER_AGENT} (?i)(bot|spider|crawler|scraper|curl|wget|python|libwww|java|httpclient) [NC]
  13. RewriteRule .* - [F,L]
  14. </IfModule>
  15.  
  16. # -----------------------------------------
  17. # Blokir bot di level SetEnvIf (Kecuali Facebook)
  18. # -----------------------------------------
  19. <IfModule mod_setenvif.c>
  20. SetEnvIfNoCase User-Agent "facebookexternalhit" !bad_bot
  21. SetEnvIfNoCase User-Agent "facebot" !bad_bot
  22. SetEnvIfNoCase User-Agent "meta-externalagent" !bad_bot
  23.  
  24. SetEnvIfNoCase User-Agent "bot" bad_bot
  25. SetEnvIfNoCase User-Agent "spider" bad_bot
  26. SetEnvIfNoCase User-Agent "crawler" bad_bot
  27. SetEnvIfNoCase User-Agent "curl" bad_bot
  28. SetEnvIfNoCase User-Agent "wget" bad_bot
  29. SetEnvIfNoCase User-Agent "python" bad_bot
  30.  
  31. <Limit GET POST HEAD>
  32. Order Allow,Deny
  33. Allow from all
  34. Deny from env=bad_bot
  35. </Limit>
  36. </IfModule>
  37.  
  38. # -----------------------------------------
  39. # Proteksi Khusus admin-ajax.php
  40. # -----------------------------------------
  41. <Files "admin-ajax.php">
  42. RewriteEngine On
  43. RewriteCond %{HTTP_USER_AGENT} (?i)(badbot|scraper|crawl|bot) [NC]
  44. RewriteRule .* - [F,L]
  45. </Files>
  46.  
  47. # BEGIN WordPress
  48. <IfModule mod_rewrite.c>
  49. RewriteEngine On
  50. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  51. RewriteBase /
  52. RewriteRule ^index\.php$ - [L]
  53. RewriteCond %{REQUEST_FILENAME} !-f
  54. RewriteCond %{REQUEST_FILENAME} !-d
  55. RewriteRule . /index.php [L]
  56. </IfModule>
  57. # END WordPress
Advertisement
Add Comment
Please, Sign In to add comment