IP2Location Redirection

外掛說明

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

顧名思義,IP2Location Redirection 是最受歡迎的外掛之一,用於處理網站的重新導向,或依據 IP 位址判定所屬國家及地區地理位置將網站訪客重新導向至預先定義的網址。

這個簡易卻功能強大的重新導向外掛,能協助網站管理員管理網站的重新導向,包含 301 及 302 重新導向。透過偵測 IP 位址地理位置資訊,即使網站管理員對 Apache 的 .haccess 檔案並不熟悉,也能夠過這個外掛輕鬆將網站訪客重新導向至其他位置。

主要功能

  • 依據網站訪客的國家及地區,將他們重新導向至指定網站頁面。
  • 依據網站訪客的國家及地區,將他們重新導向至預先定義的網址。
  • 讓網站管理員依據需求組態多個重新導向規則。
  • 支援 301 及 302 重新導向。
  • 支援 IPv4 及 IPv6。
  • 減少舊連結或中斷的連結,並協助網站管理員改善網站 SEO 排名。

這個重新導向外掛支援 IP2Location IP 位址地理位置資訊二進位資料及可查詢 IP 位址地理位置資訊的 Web 服務。如果網站使用二進位資料,網站管理員可以使用設定頁面的引導程式,每月定期更新二進位資料以取得精準結果。此外,網站管理員也可以使用以下連結手動下載並更新二進位資料檔案。

二進位檔案下載:IP2Location 商業版資料庫 | IP2Location LITE 資料庫

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

進一步了解相關資訊

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

螢幕擷圖

  • 將來自加州及紐約州的網站訪客重新導向至 https://google.com

安裝方式

使用 WordPress 控制台自動安裝

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

手動安裝

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

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

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

常見問題集

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

是。請從 https://lite.ip2location.com/database/ip-country 下載最新的 DB1 二進位檔案以進行快速測試。如需依據地區進行重新導向,請下載 https://lite.ip2location.com/database/ip-country-region-city 的 DB3 資料。

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

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

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

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

是否能同時重新導向多個國家/地區的網站訪客?

是,可以。

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

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

如何測試這個外掛?

請使用 https://www.locabrowser.com 以測試結果。

在這個頁面找不到答案?

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

使用者評論

2024 年 2 月 24 日
I couldn’t be without this plugin – works perfectly to redirect users to a specific page based on their location. Excellent work – kudos to the developer(s).
2023 年 1 月 27 日
Does exactly what it’s supposed to do. Easy and fast installation.
2022 年 9 月 26 日
The support that responded my email SK Kiu was very responsive and it eventually help to resolve my issue. Thank you.
2022 年 5 月 24 日 1 則留言
It working as it is supposed to! But then, the cache gets very large and this causes a number of issues that can crash the server. This issue has been reported by other people more than 1 year ago and still it has not been resolved AFAIK.
2022 年 1 月 14 日 3 則留言
I’ve download database .BIN and upload to folder ip2location but alls setting still disabled, then can’t working. Why can’t use API code to download database like IP2location Country Blocker?
閱讀全部 41 則使用者評論

參與者及開發者

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

參與者

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

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

對開發相關資訊感興趣?

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

變更記錄

  • 1.29.4 Fixed CIDR matching in IPv6.
  • 1.29.3 Tested up to WordPress 6.5.1.
  • 1.29.2 Fixed CSRF issues.
  • 1.29.1 Fixed database decompress error under Linux environment.
  • 1.29.0 Updated setup wizard to include IP2Location.io Geolocation API service.
  • 1.28.5 Added a private key to protect debug log.
  • 1.28.4 Randomize debug log to protect unwanted access.
  • 1.28.3 Tested up to WordPress 6.4.
  • 1.28.2 Fixed deprecated setcookie error.
  • 1.28.1 Fixed database download issue for some users.
  • 1.28.0 Added IP detection for website behind Securi firewall.
  • 1.27.1 Improved accuracy of IP detection with CloudFlare.
  • 1.27.0 Improved IP detection for reverse proxy and CloudFlare services.
  • 1.26.11 Stop obtain client IP from custom header to prevent IP spoofing.
  • 1.26.10 Updated documentation and UI tweaks.
  • 1.26.9 Added extra validation on first visit cookie.
  • 1.26.8 Tested up to WordPress 6.2
  • 1.26.7 Added source field into API web service.
  • 1.26.6 Updated to use IP2Location.io IP Geolocation API.
  • 1.26.5 Updated “Requires at least” information.
  • 1.26.4 Tested up to WordPress 6.1.
  • 1.26.3 Fixed WPML code not working with home page redirection.
  • 1.26.2 Fixed invalid URL generated during redirection. Fixed origin/destination search field missing.
  • 1.26.1 Fixed URL rule not display properly.
  • 1.26.0 Added search function on page/post listing.
  • 1.25.19 Improved home page redirection.
  • 1.25.18 Improved cache clear process and remove debug.log when option is disabled.
  • 1.25.17 Tested up to WordPress 6.0.
  • 1.25.16 Fixed issue values being reset to default on re-activation.
  • 1.25.15 Enhanced checking.
  • 1.25.14 Fixed invalid redirection for some pages.
  • 1.25.13 Added IP detection for GTranslate.
  • 1.25.12 Tested up to WordPress 5.9.
  • 1.25.11 Improved IP detection for IP forwarded by other services.
  • 1.25.10 Added better handler when BIN lookup failed.
  • 1.25.9 Removed non-exist assets.
  • 1.25.8 Removed session dependencies.
  • 1.25.7 Fixed API response.
  • 1.25.6 Prevent redirection in administrator login page.
  • 1.25.5 Fixed administrator detection. Improved infinite redirection handling.
  • 1.25.4 Prevented empty destination from saving that lead to redirection error.
  • 1.25.3 Fixed 404 error. Fixed duplicated language codes in WooCommerce.
  • 1.25.2 Fixed CSS styling issues.
  • 1.25.1 Fixed bugs and improvements.
  • 1.25.0 Fine tuned backends and redirection.
  • 1.24.1 Fixed WPML code warning.
  • 1.24.0 Added WooCommerce and WPML supports.
  • 1.23.14 Fixed issue detecting home page.
  • 1.23.13 Fixed permission issue when updating database from settings.
  • 1.23.12 Fixed error when using IPv6 CIDR in whitelist.
  • 1.23.11 Fixed administrator notice keep showing after dismissed.
  • 1.23.10 Fixed IP range mismatched when using CIDR.
  • 1.23.9 Fixed setup issue for commercial database.
  • 1.23.8 Fixed infinite redirection when using custom URL.
  • 1.23.7 Updated domain validations to support more domain extensions.
  • 1.23.6 Fixed whitespace issue in Ajax calling.
  • 1.23.5 Tested up to WordPress 5.7.
  • 1.23.4 Fixed file permission issues for some users.
  • 1.23.3 Fixed issue download token not updated.
  • 1.23.2 Fixed looping issue when using API service.
  • 1.23.1 Fixed database download issue.
  • 1.23.0 Added setup guide.
  • 1.22.1 Minor bug fixes.
  • 1.22.0 Added scheduled task to flush caches.
  • 1.21.2 Tested up to WordPress 5.6.
  • 1.21.1 Updated IP2Location library to support earlier version of PHP.
  • 1.21.0 Updated file structures to use composer for IP2Location libraries.
  • 1.20.0 Added feature to enable or disable existing rule.
  • 1.19.3 Fixed deactivation issue when conflicting with other plugins.
  • 1.19.2 Tested with WordPress 5.5.
  • 1.19.1 Updated IP2Location library to support older PHP version.
  • 1.19.0 Implemented internal cache and fixed several bugs.
  • 1.18.0 Added whitelist feature.
  • 1.17.4 Cleaned up codes and sanitized user inputs.
  • 1.17.3 Added attribution instructions.
  • 1.17.2 Fixed deactivation issue.
  • 1.17.1 Fixed missing version tag.
  • 1.17.0 Added option to ignore query string.
  • 1.16.4 Tested with WordPress 5.4.
  • 1.16.3 Prevented Ajax based job manager from redirection.
  • 1.16.2 Fixed error message.
  • 1.16.1 Updated plugin description.
  • 1.16.0 Added redirection by region.
  • 1.15.13 Increased timeout in BIN download.
  • 1.15.12 Fixed existing BIN database not updated issue.
  • 1.15.11 Minor fixes.
  • 1.15.10 Added feedback request.
  • 1.15.9 Tested with WordPress 5.3.2.
  • 1.15.8 Updated IP2Location library to 8.1.0.
  • 1.15.7 Fixed a bug when page does not exist.
  • 1.15.6 Fixed issue when customized theme is used.
  • 1.15.5 Fixed issue with multi-site WordPress.
  • 1.15.4 Updated manual upload instructions.
  • 1.15.3 Fixed issue download token not saved.
  • 1.15.2 Fixed BIN database download issue.
  • 1.15.1 Fixed redirection with WooCommerce shopping cart.
  • 1.15.0 Moved database file to WordPress upload directory to prevent existing BIN file from deleted.
    Re-structured debugging log and grouped each visitor into same section.
    Improved session cache for faster speed and save Web service queries.
  • 1.14.4 No longer look up for BIN file when Web service is used.
  • 1.14.3 Updated documentation links.
  • 1.14.2 Tested up to WordPress 5.1.1.
  • 1.14.1 Fixed IP2Location API check credit interface.
  • 1.14.0 Upgraded IP2Location API to v2.
  • 1.13.10 Fixed database file detection in both Windows and Linux environment.
  • 1.13.9 Prevent redirection when IP2Location database is missing or corrupted.
  • 1.13.8 BIN database no longer shipped together to prevent local copy being overwritten.
  • 1.13.7 Added LinkedIn and Pinterest into crawler list.
  • 1.13.6 Tested with WordPress 5.0.1.
  • 1.13.5 Fixed IP detection when server forwarded wrong IP address.
  • 1.13.4 Updated country list based on latest ISO-3166 standards.
  • 1.13.3 Added page not found handler.
  • 1.13.2 Fix bug which prevented rules from being saved.
  • 1.13.1 Fix rule insertion bug.
  • 1.13.0 Multiple countries redirection is now available with single rule.
  • 1.12.0 Domain redirection will now remain the path and query string. Fine tuned rule validations.
  • 1.11.2 Minor fixes.
  • 1.11.1 Ignore “www.” when redirect domain.
  • 1.11.0 Added debug log.
  • 1.10.2 Minor bugs fixed.
  • 1.10.1 Fixed notice dismiss issue.
  • 1.10.0 Added domain redirection.
  • 1.9.3 Fixed rule validation bugs.
  • 1.9.2 Fixed bugs.
  • 1.9.1 Minor changes.
  • 1.9.0 IP2Location database update changed to use download token.
  • 1.8.0 Added option to enable redirection for first time only. Custom URL allowed in “From” page.
  • 1.7.6 Prevent duplicated cart items during redirection.
  • 1.7.5 Fixed bots detection.
  • 1.7.4 Minor changes.
  • 1.7.3 Fixed checkbox issues in configuration page.
  • 1.7.2 Bug fixes.
  • 1.7.1 Minor update.
  • 1.7.0 Added exclude option to redirect all countries except a specified country.
  • 1.6.0 Added option to stop redirection when bots / crawlers detected. Fixed infinites loop bug with some pages.
  • 1.5.0 Refined GUI and performance improvements.
  • 1.4.1 Fixed checkbox issue.
  • 1.4.0 Added home page as redirection source.
  • 1.3.3 Fixed infinite loop when redirect within same domain using URL mode.
  • 1.3.2 Fixed conflicts when multiple IP2Location plugins installed.
  • 1.3.1 Added support for custom GET parameter.
  • 1.3.0 Use IP2Location PHP 8.0.2 library for lookup.
  • 1.2.7 Use latest IP2Location library for lookup.
  • 1.2.6 Fixed close sticky information panel issue.
  • 1.2.5 Redirection has been disabled on administrator.
  • 1.2.4 Fix uninstall function.
  • 1.2.3 Prevent settings lost when deactivate/activate the plugin.
  • 1.2.2 Use latest IP2Location library and updated the setting page.
  • 1.2.1 The redirection source and destination will list out all possible posts & pages now.
  • 1.2.0 Multiple country selection added.
  • 1.1.15 Tested with WordPress 4.4.
  • 1.1.14 Ignore redirection in admin page.
  • 1.1.13 Fixed linking issue to database file. Prevent infinite loop if wildcard chosen.
  • 1.1.12 Fixed save issues.
  • 1.1.11 Fixed warning message in WordPress 4.3.
  • 1.1.10 Fixed redirection issues. Fixed errors with earlier version of PHP.
  • 1.1.9 Fixed compatible issues with PHP 5.3 or earlier.
  • 1.1.8 Fixed errors with PHP 5.3 or earlier.
  • 1.1.7 Fixed class name issue when upgrade from previous version.
  • 1.1.6 Fixed redirection issue in iOS devices. Use latest IP2Location library.
  • 1.1.5 Remain query string after redirected to external URL.
  • 1.1.4 Fix redirect issue when URL rewrite is using.
  • 1.1.3 Will remain query string in URL after redirection.
  • 1.1.0 Added supports for IP2Location Web Service.
  • 1.0.1 Fixed issue on activation.
  • 1.0.0 First public release.