tamanmerah

htaccess for web

Oct 22nd, 2026 (edited)
24
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. # -----------------------------------------
  2. # Block bots, spiders, crawlers
  3. # -----------------------------------------
  4.  
  5. <IfModule mod_rewrite.c>
  6. RewriteEngine On
  7.  
  8. # Cek User-Agent untuk bot umum
  9. RewriteCond %{HTTP_USER_AGENT} (?i)bot [OR]
  10. RewriteCond %{HTTP_USER_AGENT} (?i)spider [OR]
  11. RewriteCond %{HTTP_USER_AGENT} (?i)crawler [OR]
  12. RewriteCond %{HTTP_USER_AGENT} (?i)scraper [OR]
  13. RewriteCond %{HTTP_USER_AGENT} (?i)curl [OR]
  14. RewriteCond %{HTTP_USER_AGENT} (?i)wget [OR]
  15. RewriteCond %{HTTP_USER_AGENT} (?i)python [OR]
  16. RewriteCond %{HTTP_USER_AGENT} (?i)libwww [OR]
  17. RewriteCond %{HTTP_USER_AGENT} (?i)java [OR]
  18. RewriteCond %{HTTP_USER_AGENT} (?i)httpclient [OR]
  19.  
  20. # Facebook / Meta
  21. RewriteCond %{HTTP_USER_AGENT} (?i)facebookexternalhit [OR]
  22. RewriteCond %{HTTP_USER_AGENT} (?i)facebot [OR]
  23. RewriteCond %{HTTP_USER_AGENT} (?i)meta-externalagent
  24.  
  25. RewriteRule .* - [F,L]
  26. </IfModule>
  27.  
  28. # -----------------------------------------
  29. # Optional: Blokir bot yang tidak sesuai standard
  30. # -----------------------------------------
  31. <IfModule mod_setenvif.c>
  32. SetEnvIfNoCase User-Agent "bot" bad_bot
  33. SetEnvIfNoCase User-Agent "spider" bad_bot
  34. SetEnvIfNoCase User-Agent "crawler" bad_bot
  35. SetEnvIfNoCase User-Agent "curl" bad_bot
  36. SetEnvIfNoCase User-Agent "wget" bad_bot
  37. SetEnvIfNoCase User-Agent "python" bad_bot
  38.  
  39. # Facebook / Meta
  40. SetEnvIfNoCase User-Agent "facebookexternalhit" bad_bot
  41. SetEnvIfNoCase User-Agent "facebot" bad_bot
  42. SetEnvIfNoCase User-Agent "meta-externalagent" bad_bot
  43.  
  44. <Limit GET POST HEAD>
  45. Order Allow,Deny
  46. Allow from all
  47. Deny from env=bad_bot
  48. </Limit>
  49. </IfModule>
  50.  
  51. <Files "admin-ajax.php">
  52. RewriteEngine On
  53. RewriteCond %{HTTP_USER_AGENT} (badbot|scraper|crawl|bot) [NC]
  54. RewriteRule .* - [F,L]
  55. </Files>
  56.  
  57. # BEGIN WordPress
  58. # Arahan (baris) antara "BEGIN WordPress" dan "END WordPress"
  59. # dihasilkan secara dinamis, dan hanya dapat dimodifikasi melalui filter WordPress.
  60. # Setiap perubahan pada arahan di antara penanda berikut akan ditimpa.
  61. <IfModule mod_rewrite.c>
  62. RewriteEngine On
  63. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  64. RewriteBase /
  65. RewriteRule ^index\.php$ - [L]
  66. RewriteCond %{REQUEST_FILENAME} !-f
  67. RewriteCond %{REQUEST_FILENAME} !-d
  68. RewriteRule . /index.php [L]
  69. </IfModule>
  70.  
  71. # END WordPress
  72.  
  73.  
  74. # php -- BEGIN cPanel-generated handler, do not edit
  75. # This domain inherits the “PHP” package.
  76. # php -- END cPanel-generated handler, do not edit
  77.  
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment