IP2Location Country Blocker

外掛說明

網站如果啟用任何快取外掛,這個外掛便無法如預期般執行。

這個外掛能以國家/地區或 Proxy 伺服器為篩選條件,封鎖不想讓他存取網站前端 (網站頁面) 或後端 (管理後台區域) 的網站訪客。透過封鎖對特定頁面或整個網站的無效存取,便能輕鬆減少惡意或無效的註冊操作。

主要功能

  • 網站管理員可以封鎖來自多個國家的網站訪客。
  • 網站管理員可以依據國家/地區分組 (例如歐盟、亞太地區等) 封鎖網站訪客。
  • 網站管理員可以封鎖來自匿名 Proxy 的網站訪客。
  • 網站管理員可以依據 IP 位址範圍封鎖網站訪客。
  • 網站管理員可以將來自 Google、Bing、Yandex 等的檢索程式納入開放清單,讓這些檢索程式將網站內容納入索引,以便利於進行 SEO。
  • 支援 IPv4 及 IPv6。
  • 網站訪客存取遭拒時,預設顯示 403 錯誤。
  • 網站管理員可以依據需求自訂 403 頁面。
  • 如果有人嘗試存取網站管理後台,外掛會傳送電子郵件通知給網站管理員。
  • 提供遭到封鎖流量的統計資料報告。

這個外掛支援 IP2Location 二進位資料及可供查詢 IP 位址所屬地理位置的 Web 服務。如果網站想要使用 IP2Location 地理位置二進位資料,網站管理員可以透過外掛設定頁面更新二進位資料。此外,網站管理員也可以使用以下連結手動下載並更新二進位資料檔案。

下載 IP 位址地理位置檔案:
IP2Location 及 IP2Proxy LITE 免費版資料庫
IP2Location 及 IP2Proxy 商業版完整資料庫

如需使用可查詢地理位置的 IP2Location IP 位址地理位置 Web 服務 (REST API),請先在 IP2Location.io IP Geolocation API 註冊可使用免費方案的帳號。

進一步了解相關資訊

請造訪 https://www.ip2location.com 以進一步了解相關資訊。

螢幕擷圖

  • 依據 IP 位址查詢國家/地區 - 讓網站管理員能夠輸入 IP 位址查詢所屬國家/地區
  • 網站前端封鎖 - 選取要封鎖哪些國家/地區的網站訪客不得存取網站內容頁面,支援頁面重新導向
  • 網站後端封鎖 - 選取要封鎖哪些國家/地區的網站訪客不得存取網站管理區域 (wp-login),支援頁面重新導向
  • 自訂錯誤頁面 - 自訂專屬錯誤頁面以搭配目前使用的佈景主題
  • 電子郵件通知 - 使用者嘗試存取網站管理後台時,傳送詳細資訊電子郵件通知網站管理員

安裝方式

使用 WordPress 控制台自動安裝

  1. 前往 [外掛]→[安裝外掛]
  2. 搜尋「IP2Location Country Blocker」。
  3. 點擊 [立即安裝] 按鈕以安裝外掛。
  4. 點擊 [啟用] 按鈕以啟用外掛。
  5. 前往 https://lite.ip2location.com (免費版) 或 https://www.ip2location.com (商業版) 註冊免費下載帳號。
  6. 在個人帳號頁面取得下載權杖。
  7. 前往管理後台選單的 [國家/地區封鎖程式] 設定頁面。
  8. 使用逐步精靈完設定。
  9. 完成以上步驟後,網站管理員便可以開始使用 IP2Location Country Blocker 封鎖特定網站訪客。

手動安裝

  1. 將壓縮檔解壓縮所得的 ip2location-country-blocker 資料夾上傳至 /wp-content/plugins/ 目錄中。
  2. 在 WordPress 管理後台的 [外掛] 選單中啟用外掛。
  3. 前往 https://lite.ip2location.com/database/ip-country (免費版) 或 https://www.ip2location.com/databases/db1-ip-country (商業版) 下載 IP2Location 資料庫。
  4. 前往 https://lite.ip2location.com/database/px1-ip-country (免費版) 或 https://www.ip2location.com/databases/px1-ip-country (商業版) 下載 IP2Proxy 資料庫。
  5. 將 .BIN 檔案解壓縮並上傳至 wp-content/uploads/ip2location 目錄中。
  6. 如果已在 https://www.ip2location.com/web-service 購買 IP2Location 服務,請在 [設定] 分頁插入 API 金鑰。
  7. 如果已在 https://www.ip2location.com/ip2proxy-web-service 購買 IP2Proxy Web 服務,請在 [設定] 分頁插入 API 金鑰。
  8. 完成以上步驟後,網站管理員便可以開始使用 IP2Location Country Blocker 封鎖特定網站訪客。

注意事項:這個外掛需要 PHP 5.4 或更新版本。

  • 如果網站使用 IP2Location LITE 資料庫,請依照這份指南將相關內容加入網站。

常見問題集

外掛安裝後,網站管理員是否需要下載二進位檔案?

是。請從 https://lite.ip2location.com/database/ip-country 下載最新的 DB1 二進位檔案以進行快速測試。

何處可以下載二進位檔案?

網站管理員可以在 https://lite.ip2location.com 下載免費 LITE 版資料或在 https://www.ip2location.com 下載商業版資料。下載的二進位檔案解壓縮後,請上傳至 wp-content/uploads/ip2location

網站管理員是否需要更新二進位檔案?

建議網站管理員每個月更新二進位檔案,讓這個外掛能使用最新的 IP 位址地理位置資訊。資料更新通常會在每個月的第一週準備就緒。

什麼是網站前端?

網站前端就是網站的內容頁面。

什麼是網站後端?

網站後端就是 WordPress 管理後台頁面。

是否能同時封鎖多個國家/地區的網站訪客?

是,可以。

網站是否能顯示 403 頁面給使用遭到封鎖的 IP 位址的網站訪客?

是,網站可以使用這個外掛提供的預設 403 頁面。

網站管理員是否能自訂錯誤頁面?

是,網站管理員可以建立包含顯示錯誤訊息的全新設計頁面,完成後便可將這個新頁面設定為 [私密] 頁面,並在外掛設定頁面將原有的頁面重新導向至新頁面。

如果有網站訪客嘗試存取網站管理後台,是否能組態電子郵件進行通知?

是,當遭到封鎖的網站訪客試圖存取網站管理後台時,網站管理員可以預先組態電子郵件進行通知。

這個外掛是否能與快取外掛 (如 W3 Total Cache) 同時使用?

否,使用這個外掛必須停用網站上的快取外掛,這個外掛才能正常執行。

如何測試這個外掛?

請造訪 https://www.locabrowser.com (針對 Proxy/VPN 服務) 以測試地理位置資訊的結果。

即使停用或移除外掛,都無法存取網站。

這可能是由使用者的本機快取所導致,請清除伺服器及瀏覽器快取。

在這個頁面找不到答案?

請將電子郵件傳送至 support@ip2location.com 與我們聯絡。

使用者評論

2024 年 2 月 3 日
I just have to say that this plugin is literally SAVING my website. I have been receiving reports about failed logins to my website (over 1k for 2-3 months!). I used a different plugin to find the IP addresses only to find that they all belong to only two countries... The plugin gives you the option to block specific IPs or countries. I started blacklisting IPs individually, but after figuring out where they are coming from, I just blacklisted those countries. Job done. Also to add because I see some reviews mentioning interference with other cache plugins (even though it's indicated in the description that they need to be disabled, which is not really the best solution), in my case, it still works with a cache plugin I use to improve my site's performance. Thank you!
2023 年 12 月 1 日
Hi guys, I installed your plugin before I knew much about it and was only able to make this work after disabling our caching plugin: W3 Total cache. I see your disclaimer about disabling all caching plugin. I am asking politely, "Please explain to us why a caching plugin prevents your plugin from working?" Caching is kind of a big deal. Comparing the Benefits of a caching plugin - to a country location blocker - I would have to say the caching plugin wins hands down as the benefits of caching helps achieve SERP ranking by improving a website's performance. I provide a TEXT link .. ( not allowed to include an actual link in a review. ) so others can see these caching benefits that I'm talking about. wordpress.org (forwardslash) plugins (forwardslash) w3-total-cache It is for this reason I give your product 2/5 stars... it works, but not without being disruptive of our website's performance.
2023 年 10 月 25 日
Absolutely brilliant plugin. Easy to install, and started working right away. One of my websites has been getting slammed for the last 5 days with a bot from one specific country. Installed the plugin late last night, and the visits from that country are already down from more than 6,600 an hour to less than 150. I have also just lowered the threshold for the plugin to start blocking front end visits from a specific IP to a much lower number, and that seems to be catching most of the ones still slipping through. Very happy with the result so far, so will be installing it on the other 4 sites I own. Thanks so much for this. It's really made my day a lot less stressful 🙂
2023 年 9 月 27 日 8 則留言
Could not make the plugin work with the latest version of Wordpress
2023 年 8 月 12 日
I installed this because I noticed that every time I installed a new WP website, the site immediately reveived tons of visitors from a specific country's search engine before it had even gone live and I had even made my first post. On an altogether different site, it turned out that the biggest trolls were non-Americans, even though my site was US-centric. I wasn't sure whether or not this plugin would work (I keep being told that it's oh, so difficult to block countries, practically impossible), but it does seem to be working. I noticed that failed login attempts went down to zero overnight, and that most of my visitors started coming from the US. Understand, though, that this plugin isn't 100% failsafe, as bad actors can also access archives of your site from the Wayback Machine or use VPNs and proxies. But it seems to do the job so far, and I'm crossing my fingers that it'll keep working in the future.
閱讀全部 111 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈IP2Location Country Blocker〉的開發相關工作。

參與者

〈IP2Location Country Blocker〉外掛目前已有 5 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈IP2Location Country Blocker〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

  • 2.34.6 Tested up to WordPress 6.5.1.
  • 2.34.5 Removed BIN database warning if Web service is used.
  • 2.34.4 Fixed CSRF issues.
  • 2.34.3 Fixed CSRF replace on API key value.
  • 2.34.2 Fixed decompress issue in Linux environment.
  • 2.34.1 Fixed SQL statement error.
  • 2.34.0 Updated setup wizard to include IP2Location.io Geolocation API service.
  • 2.33.7 Fixed value returned by get_current_url function.
  • 2.33.6 Fixed deprecated warning messages in PHP 8.
  • 2.33.5 Fixed undefined constants.
  • 2.33.4 Added a private key to protect debug log.
  • 2.33.3 Randomize debug log to protect unwanted access.
  • 2.33.2 Tested up to WordPress 6.4.1.
  • 2.33.1 Fixed string casting in PHP 8.x.
  • 2.33.0 Enabled pasting multiple IP addresses in blacklist/whitelist. Minor bugs fixed.
  • 2.32.4 Fixed undefined constant error.
  • 2.32.3 Fixed the proxy lookup issue when using IP2Location.io.
  • 2.32.2 Fixed database download issue for some users.
  • 2.32.1 Improved IP matching for IPv6.
  • 2.32.0 Added button to reset auto blacklist log.
  • 2.31.0 Added IP detection for website behind Securi firewall.
  • 2.30.2 Fixed CIDR function error.
  • 2.30.1 Improved accuracy of IP detection with CloudFlare.
  • 2.30.0 Improved IP detection for reverse proxy and CloudFlare services.
  • 2.29.2 Stop obtain client IP from custom header to prevent IP spoofing.
  • 2.29.1 Updated documentation and UI tweaks.
  • 2.28.9 Fixed undefined array key warning.
  • 2.28.8 Tested up to WordPress 6.2.
  • 2.28.7 Improve I18N Issues. (Credit: Alex Lion)
  • 2.28.6 Added source field into API web service.
  • 2.28.5 Updated to use IP2Location.io IP Geolocation API.
  • 2.28.4 Fixed error when running in wpcron.
  • 2.28.3 Updated “Requires at least” information.
  • 2.28.2 Tested up to WordPress 6.1.
  • 2.28.1 Prevent email notification when a blacklisted IP is blocked.
  • 2.28.0 Included automatic blacklist on frontend.
  • 2.27.1 Fixed typo.
  • 2.27.0 Added CIDR format supports in whitelist/blacklist. Added automatic blacklist when exceeding threshold.
  • 2.26.16 Added sorting in whitelist & blacklist. Fixed minor bugs.
  • 2.26.15 Fixed whitelist/blacklist get wiped out when inserting a reserved IP address.
  • 2.26.14 Tested up to WordPress 6.0.
  • 2.26.13 Fixed cache warning message.
  • 2.26.12 Fixed local cache storage issue.
  • 2.26.11 Further improve plugin security level.
  • 2.26.10 Migrated remote CDN scripts to host locally.
  • 2.26.9 Fixed XSS reported in https://www.exploit-db.com/exploits/50709
  • 2.26.8 Sanitized inputs to increase security level.
  • 2.26.7 Tested up to WordPress 5.9.
  • 2.26.6 Improved security against CSRF by adding nonces.
  • 2.26.5 Fixed security issues with CSRF.
  • 2.26.4 Removed missing Javascript.
  • 2.26.3 Updated default blocking template.
  • 2.26.2 Fixed header warnings.
  • 2.26.1 Fixed IP2Proxy database download.
  • 2.26.0 Performance tuning and code fixes.
  • 2.25.16 Fixed administrator notice keep showing after dismissed.
  • 2.25.15 Fixed setup issue for commercial database.
  • 2.25.14 Fixed incorrect country detected when proxy database enabled.
  • 2.25.13 Fixed library for backward compatibilities.
  • 2.25.12 Updated EU countries list.
  • 2.25.11 Fixed whitespace issue in Ajax callings.
  • 2.25.10 Use PX2 database as default for proxy lookup.
  • 2.25.9 Fixed file permission issues for some users.
  • 2.25.8 Improved manually uploaded BIN database detection.
  • 2.25.7 Removed memory restriction on IP2Proxy database download.
  • 2.25.6 Fixed missing default value on activate.
  • 2.25.5 Fixed IP2Proxy library to support PHP 7.0 and below.
  • 2.25.4 Prevent web browser from caching plugin scripts.
  • 2.25.3 Added bcmath extension checking during setup.
  • 2.25.2 Fixed setup guide issues due to memory limit when downloading IP2Proxy database.
  • 2.25.1 Fixed download issues for LITE users.
  • 2.25.0 Improved UI and added setup guide for new user.
  • 2.24.1 Tested up to WordPress 5.6.
  • 2.24.0 Added tour guide for new user.
  • 2.23.1 Updated IP2Location library to support earlier version of PHP.
  • 2.23.0 Updated file structures to use composer for IP2Location libraries.
  • 2.22.1 Minor UI update.
  • 2.22.0 Added support for blocking using proxy type.
  • 2.21.2 Fixed deactivation issue when conflicting with other plugins.
  • 2.21.1 Tested with WordPress 5.5.
  • 2.21.0 Added URL in email notification.
  • 2.20.2 Fixed warning when IP2Proxy database is not in use.
  • 2.20.1 Updated IP2Location library to support older PHP version.
  • 2.20.0 Implemented internal cache and fixed several bugs.
  • 2.19.21 Cleaned up codes and sanitized user inputs.
  • 2.19.20 Fixed variable error.
  • 2.19.19 Added attribution instructions.
  • 2.19.18 Fixed deactivation issue.
  • 2.19.17 Fixed version issue.
  • 2.19.16 Updated readme.txt.
  • 2.19.15 Tested with WordPress 5.4.
  • 2.19.14 Fixed pop out reminder not hiding.
  • 2.19.13 Fixed notification email recipient not saving.
  • 2.19.12 Increased timeout in BIN download.
  • 2.19.11 Improved UI.
  • 2.19.10 Fixed typo.
  • 2.19.9 Minor fixes.
  • 2.19.8 Added feedback request.
  • 2.19.7 Tested with WordPress 5.3.2.
  • 2.19.6 Prevented empty API key submission in settings page.
  • 2.19.5 Updated IP2Location library to 8.1.0.
  • 2.19.4 Fixed backend page detection.
  • 2.19.3 Fixed infinite redirection when using custom page.
  • 2.19.2 Removed debug message.
  • 2.19.1 Minor bugs fixed.
  • 2.19.0 Multiple features enhanced.
  • 2.18.1 Fixed minor bugs.
  • 2.18.0 Added support for dynamic admin page.
  • 2.17.6 Added FeedBurner into bot list.
  • 2.17.5 Bug fixes.
  • 2.17.4 Updated manual upload instructions.
  • 2.17.3 Fixed issue download token not saved.
  • 2.17.2 Fixed IP2Location BIN database not downloading.
  • 2.17.1 Fixed BIN database download issues.
  • 2.17.0 Migrated BIN database directory to WordPress upload directory to prevent BIN files get deleted during updates. Grouped same visitor in debugging log.
  • 2.16.0 Fixed country grouping issues.
  • 2.15.3 Updated documentation links.
  • 2.15.2 Tested up to WordPress 5.1.1.
  • 2.15.1 Fixed IP2Location API check credit interface.
  • 2.15.0 Upgraded IP2Location API to v2. Added additional checks for log table.
  • 2.14.6 Fixed database file detection in both Windows and Linux environment.
  • 2.14.5 Abort blocking when IP2Location database is missing or corrupted to prevent administrator get locked.
  • 2.14.4 BIN database no longer shipped together to prevent local copy being overwritten. Prevented IP2Location & IP2Proxy database removing each other during a database update.
  • 2.14.3 Tested with WordPress 5.0.1.
  • 2.14.2 Fixed IP detection when server forwarded wrong IP address.
  • 2.14.1 Updated country list based on latest ISO-3166 standards.
  • 2.14.0 Added country grouping to block several countries at once.
  • 2.13.2 Fixed database update issue.
  • 2.13.1 Minor bug fixed.
  • 2.13.0 Added option to enable/disable forwarder IP.
  • 2.12.0 Added option to purge all logs.
  • 2.11.3 Ignored Facebook crawler.
  • 2.11.2 Removed Facebook from bot list.
  • 2.11.1 Fixed charts display error.
  • 2.11.0 Added debug log.
  • 2.10.4 Fixed custom blocking not working.
  • 2.10.3 Minor bug fixed.
  • 2.10.2 Fixed syntax issues when using on older version of PHP.
  • 2.10.1 Minor changes.
  • 2.10.0 IP2Location database update changed to use download token.
  • 2.9.2 Fix minor bugs.
  • 2.9.1 Separated IP2Proxy as an optional service.
  • 2.9.0 Added proxy detection using IP2Proxy.
  • 2.8.8 Minor changes.
  • 2.8.7 Minor update.
  • 2.8.6 Added Serbia in the country list.
  • 2.8.5 Only administrators will be listed in notification email list.
  • 2.8.4 Fixed warnings message when there is no data in statistic charts.
  • 2.8.3 Fixed charts alignment issues when viewing with smaller screen.
  • 2.8.2 Separated charts into frontend and backend.
  • 2.8.1 Fixed notice dismiss issue.
  • 2.8.0 Allow custom bots/crawlers to bypass. Supports wildcard IP address blocking.
  • 2.7.5 Fixed empty country name in statistic charts.
  • 2.7.4 Added bots detection.
  • 2.7.3 Fixed bug in logging. Updated IP2Location database.
  • 2.7.2 Fixed empty country information in notification email.
  • 2.7.1 Skip blocking if user logged in as administrator.
  • 2.7.0 Added feature to whitelist or blacklist IP. Also option to skip blocking for logged in users.
  • 2.6.7 Fixed ban list cannot be empty.
  • 2.6.6 Bugs fixed.
  • 2.6.5 Improved Javascript performance.
  • 2.6.4 Fixed Javascript conflicts with other plugins.
  • 2.6.3 Fixed typo error.
  • 2.6.2 Minor bug fixed.
  • 2.6.1 Fixed upgrade script.
  • 2.6.0 Various changes for better user experience and performance.
  • 2.5.3 Fixed conflicts when multiple IP2Location plugins installed.
  • 2.5.2 Fixed Web service lookup issue.
  • 2.5.1 Fixed setting page issue.
  • 2.5.0 Use IP2Location PHP 8.0.2 library for lookup.
  • 2.4.5 Use latest IP2Location library for lookup.
  • 2.4.4 Fixed close sticky information panel issue.
  • 2.4.3 Fixed uninstall function.
  • 2.4.2 Prevent settings lost when deactivate/activate the plugin.
  • 2.4.1 Use latest IP2Location library for lookup and updated the setting page.
  • 2.4.0 Added option to disable log.
  • 2.3.9 Reverted changes to support older PHP version.
  • 2.3.8 Fixed warning message in WordPress 4.3.
  • 2.3.7 Fixed compatible issue with PHP 5.3 and earlier.
  • 2.3.6 Fixed compatible issue with PHP 5.3.
  • 2.3.5 Fixed issue when upgrading from previous version.
  • 2.3.4 Use latest IP2Location library for lookup.
  • 2.3.3 Fixed redirect issue with iOS devices.
  • 2.3.2 Fixed security issues for backend blocking.
  • 2.3.10 Tested with WordPress 4.4.
  • 2.3.1 Minor bug fixed.
  • 2.3.0 Fixed layout issue. Added warning if blocking own country.
  • 2.2.5 Fixed issue with secret code to by pass blocking.
  • 2.2.4 Fixed issue with Query IP. Prevent admin from blocking themselves in admin area.
  • 2.2.2 Fixed session issues.
  • 2.2.2 Fixed blocking failed in backend area.
  • 2.2.0 Added IP2Location web service support. Minor layout changes, and code behind rewrote.
  • 2.1.0 Added statistic to log blocked traffics.
  • 2.0.3 Fixed redirection issue that may not work if additional header information defined by other plugins.
  • 2.0.2 Updated redirection using javascript to rectify the not working issues reported under certain circumstances
  • 2.0.1 Fixed crash issue with other IP2Location plugins.
  • 2.0.0 Added IPv6 supports.
  • 1.9.2 Emergency bug fix.
  • 1.9.1 Fixed performance issues.
  • 1.9.0 Added logic to verify if the default old sample bin used for checking.
  • 1.8.0 Fixed the country display issue: South Georgia And The South Sandwich Islands
  • 1.7.0 Fixed download script errors.
  • 1.6.0 Added user details in the email alert message.
  • 1.5.0 Support secret code to bypass backend validation.
  • 1.4.0 Send email notification if an user from blocked countries was trying to access your backend page.
  • 1.3.0 Move the configuration page to settings, to alleviate the confusion of setting page location.
  • 1.2.0 Allow user to custom their own error page.
  • 1.1.0 Added dropdown selection for product code.