Hi MWN’ers
Berikut ini kami ingin memberikan cara untuk membatasi pengunjung situs dari luar negeri, Ada kalanya kita ingin membatasi hanya pengunjung dari dalam negeri saja yang boleh mengakses konten situs kita, dan dari luar negeri tidak bisa. Ada beberapa cara melakukannya, salah satunya dengan .htaccess yaitu memblokir alamat-alamat IP yang bukan dari Indonesia.
Pastikan terlebih dahulu bahwa anda memiliki akses ke cpanel atau akun ftp.
untuk langkah pertama adalah silahkan anda buka file.htaccess, Untuk membuka file .htaccess dapat melalui direktori public_html. Anda dapat membukanya menggunakan File Manager yang ada di cPanel akun hosting Anda. Selain itu juga Anda dapat menggunakan FTP klien.
Lalu pastikan anda memiliki IP Negara tertentu yang ingin anda batasi/blokir
Untuk mendapatkan alamat-alamat IP Indonesia, Anda dapat menggunakan misalnya layanan dari http://www.blockacountry.com/
Contoh, kalo kita pilih Indonesia aja, maka hasilnya seperti ini:
# contoh daftar alamat IP ini diambil pada 22 Apr 2010, jika sudah terlalu lama, harap ambil kembali daftar yang lebih baru. <Limit GET HEAD POST> order allow,deny deny from 58.65.240.0/21 deny from 58.145.168.0/21 deny from 58.147.184.0/21 deny from 60.253.96.0/19 deny from 61.5.0.0/17 deny from 61.8.64.0/20 deny from 61.94.0.0/16 deny from 61.247.0.0/18 deny from 116.0.0.0/21 deny from 116.12.40.0/21 deny from 116.50.24.0/21 deny from 116.58.192.0/21 deny from 116.66.200.0/21 deny from 116.68.160.0/20 deny from 116.68.224.0/21 deny from 116.68.248.0/21 deny from 116.90.160.0/20 deny from 116.90.176.0/21 deny from 116.90.208.0/21 deny from 116.197.128.0/21 deny from 116.199.192.0/21 deny from 116.199.200.0/21 deny from 116.212.72.0/21 deny from 116.212.96.0/21 deny from 116.254.96.0/21 deny from 116.254.112.0/21 deny from 116.254.120.0/21 deny from 117.18.16.0/21 deny from 117.20.48.0/20 deny from 117.54.0.0/16 deny from 121.50.32.0/21 deny from 121.50.128.0/20 deny from 121.52.0.0/17 deny from 121.100.0.0/21 deny from 121.100.16.0/21 deny from 122.102.48.0/21 deny from 122.128.16.0/21 deny from 122.129.192.0/21 deny from 122.144.0.0/21 deny from 122.200.0.0/20 deny from 122.200.48.0/21 deny from 122.200.144.0/21 deny from 123.108.8.0/21 deny from 123.176.120.0/21 deny from 123.231.128.0/18 deny from 123.231.192.0/19 deny from 124.66.160.0/21 deny from 124.81.0.0/16 deny from 124.108.0.0/24 deny from 124.153.0.0/18 deny from 124.158.128.0/18 deny from 124.195.0.0/17 deny from 125.160.0.0/14 deny from 125.164.0.0/16 deny from 125.208.128.0/18 deny from 125.213.128.0/19 deny from 141.103.0.0/16 deny from 152.118.0.0/16 deny from 167.205.0.0/16 deny from 169.223.0.0/16 deny from 192.41.206.0/24 deny from 192.73.24.0/24 deny from 192.73.25.0/24 deny from 192.188.175.0/24 deny from 198.51.101.0/24 deny from 202.0.81.0/24 deny from 202.0.103.0/24 deny from 202.0.116.0/24 deny from 202.3.208.0/20 deny from 202.6.208.0/20 deny from 202.6.224.0/20 deny from 202.14.255.0/24 deny from 202.20.106.0/24 deny from 202.20.107.0/24 deny from 202.20.108.0/23 deny from 202.22.31.0/24 deny from 202.43.160.0/20 deny from 202.43.176.0/20 deny from 202.43.248.0/22 deny from 202.43.252.0/22 deny from 202.46.0.0/20 deny from 202.46.16.0/24 deny from 202.46.17.0/24 deny from 202.46.18.0/24 deny from 202.46.20.0/23 deny from 202.46.24.0/21 deny from 202.46.64.0/19 deny from 202.46.96.0/20 deny from 202.46.128.0/24 deny from 202.46.129.0/24 deny from 202.46.130.0/23 deny from 202.46.144.0/20 deny from 202.46.240.0/20 deny from 202.47.64.0/20 deny from 202.47.192.0/19 deny from 202.51.16.0/20 deny from 202.51.56.0/21 deny from 202.51.96.0/19 deny from 202.51.192.0/19 deny from 202.51.224.0/20 deny from 202.51.252.0/22 deny from 202.52.8.0/21 deny from 202.53.224.0/19 deny from 202.55.128.0/20 deny from 202.55.160.0/20 deny from 202.56.160.0/21 deny from 202.56.168.0/21 deny from 202.57.4.0/23 deny from 202.57.6.0/23 deny from 202.57.8.0/21 deny from 202.57.16.0/20 deny from 202.58.64.0/20 deny from 202.58.160.0/20 deny from 202.58.176.0/21 deny from 202.58.192.0/20 deny from 202.58.208.0/20 deny from 202.59.160.0/20 deny from 202.59.192.0/20 deny from 202.62.8.0/21 deny from 202.62.16.0/20 deny from 202.62.240.0/21 deny from 202.65.112.0/20 deny from 202.65.224.0/20 deny from 202.67.8.0/21 deny from 202.67.32.0/20 deny from 202.69.96.0/20 deny from 202.70.48.0/20 deny from 202.72.192.0/20 deny from 202.72.208.0/20 deny from 202.73.16.0/20 deny from 202.73.96.0/19 deny from 202.73.224.0/20 deny from 202.74.72.0/21 deny from 202.75.16.0/20 deny from 202.75.96.0/20 deny from 202.77.64.0/20 deny from 202.77.96.0/19 deny from 202.78.192.0/20 deny from 202.80.112.0/20 deny from 202.80.208.0/20 deny from 202.81.32.0/20 deny from 202.81.48.0/20 deny from 202.87.176.0/20 deny from 202.87.192.0/20 deny from 202.87.240.0/21 deny from 202.87.248.0/21 deny from 202.89.208.0/20 deny from 202.91.8.0/21 deny from 202.91.24.0/21 deny from 202.92.192.0/20 deny from 202.93.16.0/20 deny from 202.93.32.0/20 deny from 202.93.112.0/20 deny from 202.93.128.0/20 deny from 202.93.224.0/20 deny from 202.93.240.0/21 deny from 202.95.128.0/19 deny from 202.122.8.0/21 deny from 202.122.160.0/20 deny from 202.123.224.0/20 deny from 202.127.32.0/21 deny from 202.127.96.0/20 deny from 202.129.184.0/21 deny from 202.133.0.0/21 deny from 202.133.80.0/20 deny from 202.134.0.0/22 deny from 202.134.4.0/22 deny from 202.136.64.0/19 deny from 202.137.0.0/22 deny from 202.137.4.0/22 deny from 202.137.8.0/21 deny from 202.137.16.0/22 deny from 202.137.20.0/22 deny from 202.137.24.0/21 deny from 202.138.224.0/19 deny from 202.143.32.0/20 deny from 202.143.96.0/20 deny from 202.145.0.0/22 deny from 202.145.4.0/22 deny from 202.145.8.0/21 deny from 202.146.0.0/23 deny from 202.146.2.0/23 deny from 202.146.4.0/23 deny from 202.146.32.0/19 deny from 202.146.128.0/19 deny from 202.146.176.0/21 deny from 202.146.224.0/20 deny from 202.146.240.0/21 deny from 202.146.248.0/22 deny from 202.146.252.0/23 deny from 202.146.254.0/23 deny from 202.147.192.0/20 deny from 202.147.224.0/19 deny from 202.148.0.0/19 deny from 202.149.64.0/19 deny from 202.149.128.0/19 deny from 202.150.0.0/22 deny from 202.150.4.0/22 deny from 202.150.8.0/21 deny from 202.150.32.0/20 deny from 202.150.64.0/19 deny from 202.150.128.0/19 deny from 202.150.160.0/20 deny from 202.150.224.0/19 deny from 202.151.0.0/22 deny from 202.151.8.0/21 deny from 202.152.0.0/22 deny from 202.152.4.0/22 deny from 202.152.8.0/21 deny from 202.152.16.0/20 deny from 202.152.32.0/20 deny from 202.152.48.0/20 deny from 202.152.128.0/19 deny from 202.152.160.0/20 deny from 202.152.192.0/20 deny from 202.152.224.0/19 deny from 202.153.16.0/20 deny from 202.153.128.0/19 deny from 202.153.224.0/19 deny from 202.154.0.0/20 deny from 202.154.16.0/20 deny from 202.154.32.0/23 deny from 202.154.34.0/24 deny from 202.154.35.0/24 deny from 202.154.36.0/22 deny from 202.154.40.0/21 deny from 202.154.48.0/20 deny from 202.154.176.0/20 deny from 202.155.0.0/23 deny from 202.155.2.0/23 deny from 202.155.4.0/22 deny from 202.155.8.0/21 deny from 202.155.16.0/20 deny from 202.155.32.0/19 deny from 202.155.64.0/19 deny from 202.155.96.0/19 deny from 202.155.128.0/19 deny from 202.158.0.0/22 deny from 202.158.4.0/22 deny from 202.158.8.0/21 deny from 202.158.16.0/20 deny from 202.158.32.0/19 deny from 202.158.64.0/19 deny from 202.158.96.0/19 deny from 202.158.128.0/20 deny from 202.159.0.0/21 deny from 202.159.8.0/21 deny from 202.159.16.0/20 deny from 202.159.32.0/19 deny from 202.159.64.0/18 deny from 202.162.32.0/20 deny from 202.162.192.0/20 deny from 202.162.208.0/20 deny from 202.164.216.0/21 deny from 202.165.32.0/20 deny from 202.169.32.0/20 deny from 202.169.48.0/20 deny from 202.169.224.0/20 deny from 202.169.240.0/20 deny from 202.170.224.0/19 deny from 202.171.0.0/20 deny from 202.171.16.0/20 deny from 202.173.16.0/21 deny from 202.173.64.0/19 deny from 202.179.184.0/21 deny from 202.180.0.0/19 deny from 202.180.48.0/21 deny from 202.182.48.0/21 deny from 202.182.56.0/21 deny from 202.182.160.0/19 deny from 202.183.0.0/19 deny from 202.191.2.0/23 deny from 203.14.176.0/24 deny from 203.31.164.0/23 deny from 203.34.118.0/23 deny from 203.77.208.0/20 deny from 203.77.224.0/19 deny from 203.78.112.0/20 deny from 203.80.8.0/21 deny from 203.81.184.0/21 deny from 203.81.248.0/22 deny from 203.83.24.0/21 deny from 203.83.32.0/20 deny from 203.84.136.0/21 deny from 203.84.152.0/21 deny from 203.89.16.0/21 deny from 203.89.24.0/21 deny from 203.99.96.0/19 deny from 203.119.13.0/24 deny from 203.119.41.0/24 deny from 203.119.48.0/24 deny from 203.119.52.0/22 deny from 203.123.224.0/19 deny from 203.128.64.0/19 deny from 203.128.248.0/22 deny from 203.130.192.0/19 deny from 203.130.224.0/19 deny from 203.134.232.0/21 deny from 203.135.176.0/21 deny from 203.142.64.0/20 deny from 203.142.80.0/21 deny from 203.153.0.0/22 deny from 203.153.24.0/21 deny from 203.153.96.0/20 deny from 203.153.112.0/21 deny from 203.153.120.0/21 deny from 203.160.56.0/21 deny from 203.161.16.0/20 deny from 203.166.192.0/20 deny from 203.173.88.0/21 deny from 203.174.8.0/21 deny from 203.176.176.0/21 deny from 203.190.40.0/21 deny from 203.190.48.0/21 deny from 203.190.112.0/21 deny from 203.190.184.0/21 deny from 203.190.240.0/21 deny from 203.191.40.0/21 deny from 203.201.160.0/20 deny from 210.23.64.0/20 deny from 210.57.208.0/20 deny from 210.210.128.0/19 deny from 210.210.160.0/19 deny from 210.211.16.0/21 deny from 218.33.0.0/17 deny from 218.100.4.0/24 deny from 218.100.11.0/24 deny from 218.100.27.0/24 deny from 218.100.28.0/24 deny from 218.100.29.0/24 deny from 218.100.30.0/24 deny from 218.100.31.0/24 deny from 218.100.32.0/24 deny from 218.100.33.0/24 deny from 218.100.34.0/24 deny from 218.100.35.0/24 deny from 218.100.41.0/24 deny from 219.83.0.0/17 deny from 220.157.96.0/20 deny from 220.247.168.0/21 deny from 221.132.192.0/18 deny from 222.124.0.0/16 deny from 222.229.80.0/21 allow from all </LIMIT>
namun contoh di atas adalah jika kita ingin memblokir pengunjung dari Indonesia. Jika kita hanya ingin mengizinkan pengunjung dari Indonesia, maka kita balik aturannya sehingga menjadi sbb:
# contoh daftar alamat IP ini diambil pada 22 Apr 2010, jika sudah terlalu lama, harap ambil kembali daftar yang lebih baru. <Limit GET HEAD POST> order allow,deny allow from 58.65.240.0/21 allow from 58.145.168.0/21 allow from 58.147.184.0/21 allow from 60.253.96.0/19 allow from 61.5.0.0/17 allow from 61.8.64.0/20 allow from 61.94.0.0/16 allow from 61.247.0.0/18 allow from 116.0.0.0/21 allow from 116.12.40.0/21 allow from 116.50.24.0/21 allow from 116.58.192.0/21 allow from 116.66.200.0/21 allow from 116.68.160.0/20 allow from 116.68.224.0/21 allow from 116.68.248.0/21 allow from 116.90.160.0/20 allow from 116.90.176.0/21 allow from 116.90.208.0/21 allow from 116.197.128.0/21 allow from 116.199.192.0/21 allow from 116.199.200.0/21 allow from 116.212.72.0/21 allow from 116.212.96.0/21 allow from 116.254.96.0/21 allow from 116.254.112.0/21 allow from 116.254.120.0/21 allow from 117.18.16.0/21 allow from 117.20.48.0/20 allow from 117.54.0.0/16 allow from 121.50.32.0/21 allow from 121.50.128.0/20 allow from 121.52.0.0/17 allow from 121.100.0.0/21 allow from 121.100.16.0/21 allow from 122.102.48.0/21 allow from 122.128.16.0/21 allow from 122.129.192.0/21 allow from 122.144.0.0/21 allow from 122.200.0.0/20 allow from 122.200.48.0/21 allow from 122.200.144.0/21 allow from 123.108.8.0/21 allow from 123.176.120.0/21 allow from 123.231.128.0/18 allow from 123.231.192.0/19 allow from 124.66.160.0/21 allow from 124.81.0.0/16 allow from 124.108.0.0/24 allow from 124.153.0.0/18 allow from 124.158.128.0/18 allow from 124.195.0.0/17 allow from 125.160.0.0/14 allow from 125.164.0.0/16 allow from 125.208.128.0/18 allow from 125.213.128.0/19 allow from 141.103.0.0/16 allow from 152.118.0.0/16 allow from 167.205.0.0/16 allow from 169.223.0.0/16 allow from 192.41.206.0/24 allow from 192.73.24.0/24 allow from 192.73.25.0/24 allow from 192.188.175.0/24 allow from 198.51.101.0/24 allow from 202.0.81.0/24 allow from 202.0.103.0/24 allow from 202.0.116.0/24 allow from 202.3.208.0/20 allow from 202.6.208.0/20 allow from 202.6.224.0/20 allow from 202.14.255.0/24 allow from 202.20.106.0/24 allow from 202.20.107.0/24 allow from 202.20.108.0/23 allow from 202.22.31.0/24 allow from 202.43.160.0/20 allow from 202.43.176.0/20 allow from 202.43.248.0/22 allow from 202.43.252.0/22 allow from 202.46.0.0/20 allow from 202.46.16.0/24 allow from 202.46.17.0/24 allow from 202.46.18.0/24 allow from 202.46.20.0/23 allow from 202.46.24.0/21 allow from 202.46.64.0/19 allow from 202.46.96.0/20 allow from 202.46.128.0/24 allow from 202.46.129.0/24 allow from 202.46.130.0/23 allow from 202.46.144.0/20 allow from 202.46.240.0/20 allow from 202.47.64.0/20 allow from 202.47.192.0/19 allow from 202.51.16.0/20 allow from 202.51.56.0/21 allow from 202.51.96.0/19 allow from 202.51.192.0/19 allow from 202.51.224.0/20 allow from 202.51.252.0/22 allow from 202.52.8.0/21 allow from 202.53.224.0/19 allow from 202.55.128.0/20 allow from 202.55.160.0/20 allow from 202.56.160.0/21 allow from 202.56.168.0/21 allow from 202.57.4.0/23 allow from 202.57.6.0/23 allow from 202.57.8.0/21 allow from 202.57.16.0/20 allow from 202.58.64.0/20 allow from 202.58.160.0/20 allow from 202.58.176.0/21 allow from 202.58.192.0/20 allow from 202.58.208.0/20 allow from 202.59.160.0/20 allow from 202.59.192.0/20 allow from 202.62.8.0/21 allow from 202.62.16.0/20 allow from 202.62.240.0/21 allow from 202.65.112.0/20 allow from 202.65.224.0/20 allow from 202.67.8.0/21 allow from 202.67.32.0/20 allow from 202.69.96.0/20 allow from 202.70.48.0/20 allow from 202.72.192.0/20 allow from 202.72.208.0/20 allow from 202.73.16.0/20 allow from 202.73.96.0/19 allow from 202.73.224.0/20 allow from 202.74.72.0/21 allow from 202.75.16.0/20 allow from 202.75.96.0/20 allow from 202.77.64.0/20 allow from 202.77.96.0/19 allow from 202.78.192.0/20 allow from 202.80.112.0/20 allow from 202.80.208.0/20 allow from 202.81.32.0/20 allow from 202.81.48.0/20 allow from 202.87.176.0/20 allow from 202.87.192.0/20 allow from 202.87.240.0/21 allow from 202.87.248.0/21 allow from 202.89.208.0/20 allow from 202.91.8.0/21 allow from 202.91.24.0/21 allow from 202.92.192.0/20 allow from 202.93.16.0/20 allow from 202.93.32.0/20 allow from 202.93.112.0/20 allow from 202.93.128.0/20 allow from 202.93.224.0/20 allow from 202.93.240.0/21 allow from 202.95.128.0/19 allow from 202.122.8.0/21 allow from 202.122.160.0/20 allow from 202.123.224.0/20 allow from 202.127.32.0/21 allow from 202.127.96.0/20 allow from 202.129.184.0/21 allow from 202.133.0.0/21 allow from 202.133.80.0/20 allow from 202.134.0.0/22 allow from 202.134.4.0/22 allow from 202.136.64.0/19 allow from 202.137.0.0/22 allow from 202.137.4.0/22 allow from 202.137.8.0/21 allow from 202.137.16.0/22 allow from 202.137.20.0/22 allow from 202.137.24.0/21 allow from 202.138.224.0/19 allow from 202.143.32.0/20 allow from 202.143.96.0/20 allow from 202.145.0.0/22 allow from 202.145.4.0/22 allow from 202.145.8.0/21 allow from 202.146.0.0/23 allow from 202.146.2.0/23 allow from 202.146.4.0/23 allow from 202.146.32.0/19 allow from 202.146.128.0/19 allow from 202.146.176.0/21 allow from 202.146.224.0/20 allow from 202.146.240.0/21 allow from 202.146.248.0/22 allow from 202.146.252.0/23 allow from 202.146.254.0/23 allow from 202.147.192.0/20 allow from 202.147.224.0/19 allow from 202.148.0.0/19 allow from 202.149.64.0/19 allow from 202.149.128.0/19 allow from 202.150.0.0/22 allow from 202.150.4.0/22 allow from 202.150.8.0/21 allow from 202.150.32.0/20 allow from 202.150.64.0/19 allow from 202.150.128.0/19 allow from 202.150.160.0/20 allow from 202.150.224.0/19 allow from 202.151.0.0/22 allow from 202.151.8.0/21 allow from 202.152.0.0/22 allow from 202.152.4.0/22 allow from 202.152.8.0/21 allow from 202.152.16.0/20 allow from 202.152.32.0/20 allow from 202.152.48.0/20 allow from 202.152.128.0/19 allow from 202.152.160.0/20 allow from 202.152.192.0/20 allow from 202.152.224.0/19 allow from 202.153.16.0/20 allow from 202.153.128.0/19 allow from 202.153.224.0/19 allow from 202.154.0.0/20 allow from 202.154.16.0/20 allow from 202.154.32.0/23 allow from 202.154.34.0/24 allow from 202.154.35.0/24 allow from 202.154.36.0/22 allow from 202.154.40.0/21 allow from 202.154.48.0/20 allow from 202.154.176.0/20 allow from 202.155.0.0/23 allow from 202.155.2.0/23 allow from 202.155.4.0/22 allow from 202.155.8.0/21 allow from 202.155.16.0/20 allow from 202.155.32.0/19 allow from 202.155.64.0/19 allow from 202.155.96.0/19 allow from 202.155.128.0/19 allow from 202.158.0.0/22 allow from 202.158.4.0/22 allow from 202.158.8.0/21 allow from 202.158.16.0/20 allow from 202.158.32.0/19 allow from 202.158.64.0/19 allow from 202.158.96.0/19 allow from 202.158.128.0/20 allow from 202.159.0.0/21 allow from 202.159.8.0/21 allow from 202.159.16.0/20 allow from 202.159.32.0/19 allow from 202.159.64.0/18 allow from 202.162.32.0/20 allow from 202.162.192.0/20 allow from 202.162.208.0/20 allow from 202.164.216.0/21 allow from 202.165.32.0/20 allow from 202.169.32.0/20 allow from 202.169.48.0/20 allow from 202.169.224.0/20 allow from 202.169.240.0/20 allow from 202.170.224.0/19 allow from 202.171.0.0/20 allow from 202.171.16.0/20 allow from 202.173.16.0/21 allow from 202.173.64.0/19 allow from 202.179.184.0/21 allow from 202.180.0.0/19 allow from 202.180.48.0/21 allow from 202.182.48.0/21 allow from 202.182.56.0/21 allow from 202.182.160.0/19 allow from 202.183.0.0/19 allow from 202.191.2.0/23 allow from 203.14.176.0/24 allow from 203.31.164.0/23 allow from 203.34.118.0/23 allow from 203.77.208.0/20 allow from 203.77.224.0/19 allow from 203.78.112.0/20 allow from 203.80.8.0/21 allow from 203.81.184.0/21 allow from 203.81.248.0/22 allow from 203.83.24.0/21 allow from 203.83.32.0/20 allow from 203.84.136.0/21 allow from 203.84.152.0/21 allow from 203.89.16.0/21 allow from 203.89.24.0/21 allow from 203.99.96.0/19 allow from 203.119.13.0/24 allow from 203.119.41.0/24 allow from 203.119.48.0/24 allow from 203.119.52.0/22 allow from 203.123.224.0/19 allow from 203.128.64.0/19 allow from 203.128.248.0/22 allow from 203.130.192.0/19 allow from 203.130.224.0/19 allow from 203.134.232.0/21 allow from 203.135.176.0/21 allow from 203.142.64.0/20 allow from 203.142.80.0/21 allow from 203.153.0.0/22 allow from 203.153.24.0/21 allow from 203.153.96.0/20 allow from 203.153.112.0/21 allow from 203.153.120.0/21 allow from 203.160.56.0/21 allow from 203.161.16.0/20 allow from 203.166.192.0/20 allow from 203.173.88.0/21 allow from 203.174.8.0/21 allow from 203.176.176.0/21 allow from 203.190.40.0/21 allow from 203.190.48.0/21 allow from 203.190.112.0/21 allow from 203.190.184.0/21 allow from 203.190.240.0/21 allow from 203.191.40.0/21 allow from 203.201.160.0/20 allow from 210.23.64.0/20 allow from 210.57.208.0/20 allow from 210.210.128.0/19 allow from 210.210.160.0/19 allow from 210.211.16.0/21 allow from 218.33.0.0/17 allow from 218.100.4.0/24 allow from 218.100.11.0/24 allow from 218.100.27.0/24 allow from 218.100.28.0/24 allow from 218.100.29.0/24 allow from 218.100.30.0/24 allow from 218.100.31.0/24 allow from 218.100.32.0/24 allow from 218.100.33.0/24 allow from 218.100.34.0/24 allow from 218.100.35.0/24 allow from 218.100.41.0/24 allow from 219.83.0.0/17 allow from 220.157.96.0/20 allow from 220.247.168.0/21 allow from 221.132.192.0/18 allow from 222.124.0.0/16 allow from 222.229.80.0/21 deny from all </LIMIT>
Atau anda juga bisa mendapatkan daftar alamat IP berdasarkan Negara melalui website : https://www.countryipblocks.net/acl.php
- Pilih negara yang ingin Anda blokir atau ingin Anda beri hak akses.
- Pilih .htaccess Deny untuk memblokir dan .htaccess Allow untuk ijin hak akses
- Kemudian klik tombol Create ACL.
Kemudian salin IP yang dihasilkan kedalam file .htaccess anda
Setelah itu Anda tinggal mengcopynya ke dalam file .htaccess dengan menekan tombol CTRL+V.
Catatan
- Efektivitas tidak bisa 100% karena ada alamat IP yang tidak terdaftar, ada yang menggunakan tunnelling, ada yang menggunakan proxy dalam negeri, dsb.
- Agar tetap akurat, daftar blok ini harus sering-sering diperbarui.
Tanya jawab
Jika ada pengunjung luar negeri yang terkena blokir, halaman apa yang akan dilihat olehnya?
Halaman pesan kesalahan 403 / Forbidden dari webserver. Jika Anda ingin mengkustomisasi pesan kesalahan ini, bisa dengan cara mengarahkannya ke subdomain lain misalnyahttp://message.example.com/. Caranya dengan menaruh baris seperti ini di awal file .htaccess Anda (silakan sesuaikan URL-nya dengan yang sebenarnya):
ErrorDocument 403 http://message.example.com/only-from-indonesia.html
Kenapa harus ke subdomain lain? Karena si pengunjung tersebut tidak bisa mengakses situs Anda sama sekali, jadi tidak mungkin menaruh pesan kesalahannya di dalam situs itu sendiri ?
Google dan Alexa jadi terblokir! Bagaimana agar bisa mengizinkan search engine dan bot seperti Google, Alexa, Bing, dll?
XXX