כיצד לחסום בוטים ומזהי משתמשים ספאמרים לאתר כדי לשפר משמעותית את המהירות ואבטחה
כדי לבצע זאת אני יצרתי עבורכת רשימה ענקית שלקוחה ממספר רב של מקורות אבטחה , ואלו כוללים רשימות של
badbots, baduseragents ו-bad referrals כאשר האחרון יכול להוריד את דירוג האתר משמעותית בגוגל!
על מנת להרכיב את הרשימה בחנתי שלל אמצעים כגון הרשימה שמספקים
ultimate-bad-bot-blocker
אשר יצרו תוכנה להתקנה על השרת בדיוק לצורך זה ועוד שלל רחב של שירותים אותם אין צורך להתחיל להרחיב כאן.
כדי ליישם את הפתרון אנחנו נוסיף בסוף קובץ ה
.htacess
שלנו שבראש הירככית התיקיות של האתר – בדרך כלל בpublic_html את הקוד הנל :
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
AddType image/webp .webp
# Stop hotlinking.
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^https?://([^/]+)/ [NC]
RewriteCond %1#%{HTTP_HOST} !^(.+)#\1$
RewriteRule \.(jpg|jpeg|png|gif|swf|svg)$ – [NC,F,L]
# Add Caching.
Header set Cache-Control "max-age=2160000"
# Prevent viewing of htaccess file.
order allow,deny
deny from all
# Prevent directory listings
Options All -Indexes
# Block verified badbots by IP
order allow,deny
deny from 102.165.53.68
deny from 103.254.185.195
deny from 103.35.132.50
deny from 103.69.220.11
deny from 104.131.138.121
deny from 104.199.80.9
deny from 105.247.240.34
deny from 109.226.37.39
deny from 109.95.32.172
deny from 110.78.146.220
deny from 111.125.143.174
deny from 112.199.205.224
deny from 115.144.4.210
deny from 115.144.9.181
deny from 116.212.131.174
deny from 121.126.188.139
deny from 121.126.188.142
deny from 121.126.215.6
deny from 121.126.63.64
deny from 124.198.17.197
deny from 125.7.187.164
deny from 128.90.130.189
deny from 130.211.96.77
deny from 130.255.130.147
deny from 136.144.177.120
deny from 136.169.243.166
deny from 138.121.83.252
deny from 138.197.9.0
deny from 138.36.159.229
deny from 138.94.162.120
deny from 139.99.218.30
deny from 142.93.119.142
deny from 144.217.178.162
deny from 145.255.21.167
deny from 145.255.21.187
deny from 145.255.22.69
deny from 145.255.22.80
deny from 148.251.179.90
deny from 149.202.86.127
deny from 152.136.107.42
deny from 152.44.107.89
deny from 154.124.251.157
deny from 154.86.238.66
deny from 157.193.5.114
deny from 160.119.126.119
deny from 162.221.200.177
deny from 162.244.33.75
deny from 164.132.119.83
deny from 167.86.89.241
deny from 167.86.98.221
deny from 168.205.217.53
deny from 173.212.221.48
deny from 173.212.222.76
deny from 173.212.245.25
deny from 176.105.211.163
deny from 176.115.92.193
deny from 176.226.247.90
deny from 176.65.112.118
deny from 177.17.0.197
deny from 178.132.2.5
deny from 178.141.249.246
deny from 178.150.134.122
deny from 178.150.151.3
deny from 178.165.124.227
deny from 178.165.13.220
deny from 178.216.123.138
deny from 178.57.55.139
deny from 178.67.208.215
deny from 179.189.29.235
deny from 182.73.56.130
deny from 183.78.133.140
deny from 183.88.238.243
deny from 185.129.126.19
deny from 185.129.215.144
deny from 185.251.38.166
deny from 185.33.33.234
deny from 185.51.169.18
deny from 185.63.191.53
deny from 185.69.55.150
deny from 185.82.65.48
deny from 186.137.31.81
deny from 187.44.110.177
deny from 188.165.243.162
deny from 188.240.208.26
deny from 188.243.253.154
deny from 190.2.142.93
deny from 190.85.136.34
deny from 192.154.101.130
deny from 192.3.93.32
deny from 192.99.175.109
deny from 193.151.27.50
deny from 194.114.129.131
deny from 194.58.70.120
deny from 195.154.251.86
deny from 195.162.24.218
deny from 195.69.237.162
deny from 198.245.62.136
deny from 199.249.230.111
deny from 200.25.255.26
deny from 200.5.254.154
deny from 201.172.198.56
deny from 202.91.69.174
deny from 203.109.17.214
deny from 207.180.207.173
deny from 209.36.1.226
deny from 209.99.173.184
deny from 212.100.94.86
deny from 212.24.99.35
deny from 212.33.228.161
deny from 212.55.100.21
deny from 213.152.162.84
deny from 213.166.69.172
deny from 217.146.82.232
deny from 23.229.58.49
deny from 23.250.104.177
deny from 23.250.125.234
deny from 23.94.5.110
deny from 24.4.16.81
deny from 3.86.232.124
deny from 3.90.43.52
deny from 31.210.170.131
deny from 34.228.80.247
deny from 34.76.251.191
deny from 35.187.180.136
deny from 35.187.86.35
deny from 35.195.65.87
deny from 35.205.75.161
deny from 35.208.149.93
deny from 35.241.138.178
deny from 36.255.84.67
deny from 37.187.26.42
deny from 37.59.56.206
deny from 37.72.168.154
deny from 41.242.165.56
deny from 45.119.88.121
deny from 46.150.65.126
deny from 46.180.180.112
deny from 46.187.51.78
deny from 46.187.62.115
deny from 46.191.232.236
deny from 46.229.173.66
deny from 46.229.173.67
deny from 46.229.173.68
deny from 46.231.12.250
deny from 46.35.224.58
deny from 46.35.233.128
deny from 46.35.244.117
deny from 46.4.130.245
deny from 46.53.253.124
deny from 47.90.243.113
deny from 49.254.241.119
deny from 49.35.104.214
deny from 5.143.13.93
deny from 5.149.211.218
deny from 5.157.24.58
deny from 5.164.146.133
deny from 5.196.203.169
deny from 5.28.23.240
deny from 5.44.170.66
deny from 5.45.64.76
deny from 5.45.76.244
deny from 5.79.161.252
deny from 5.83.160.240
deny from 51.68.152.26
deny from 51.75.90.211
deny from 51.75.92.17
deny from 51.77.52.160
deny from 51.83.76.186
deny from 52.203.142.240
deny from 52.87.213.12
deny from 54.37.1.12
deny from 54.38.123.235
deny from 62.112.9.146
deny from 62.113.28.13
deny from 66.206.35.62
deny from 69.197.162.90
deny from 74.208.84.134
deny from 76.164.203.130
deny from 76.27.97.18
deny from 77.207.216.201
deny from 77.34.40.143
deny from 77.35.214.210
deny from 77.51.48.6
deny from 77.51.76.64
deny from 78.30.214.165
deny from 81.193.197.103
deny from 82.162.122.49
deny from 82.162.186.51
deny from 82.24.14.151
deny from 84.10.172.234
deny from 84.10.27.82
deny from 85.202.83.176
deny from 85.93.20.34
deny from 86.102.34.102
deny from 87.98.145.188
deny from 89.16.211.16
deny from 89.35.39.60
deny from 91.122.30.68
deny from 91.122.50.187
deny from 91.151.199.206
deny from 91.220.140.112
deny from 91.224.178.177
deny from 91.232.188.5
deny from 92.0.113.31
deny from 93.170.115.179
deny from 93.170.219.30
deny from 93.170.219.33
deny from 93.90.192.252
deny from 94.228.252.85
deny from 94.23.0.85
deny from 94.23.37.191
deny from 95.105.254.219
deny from 95.216.249.71
deny from 95.47.10.142
deny from 95.72.130.47
deny from 95.72.4.19
deny from 95.73.248.159
allow from all
# Add Caching.
Header set Cache-Control "max-age=2160000"
# php — BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.
AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
# php — END cPanel-generated handler, do not edit
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
php_flag display_errors Off
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 5000
php_value memory_limit 800M
php_value post_max_size 380M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php82"
php_value upload_max_filesize 320M
php_flag zlib.output_compression On
php_flag display_errors Off
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 5000
php_value memory_limit 800M
php_value post_max_size 380M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php82"
php_value upload_max_filesize 320M
php_flag zlib.output_compression On
# END cPanel-generated php ini directives, do not edit
כפי שניתן לראות כבר הוספתי לכם את כל הבוטים הרעים – מעל 9000 במספר, וכל מזהי המשתמשים \useragents שסווגו כספאמרים
- על ידי הוספת הקוד ל
htacess
שלכם – תהינו מהגנה משופרת וזמני טעינה ופחות מתקפות של סריקות שתופסות המון משאבים ומעטים את האתר