Apache Module
This is an IP2Location Apache Module that enables the user to identify the country, region, city, latitude, longitude, zip code, time zone, ISP, domain name, connection type, area code and weather by IP address. It contains a demo IP2Location IP-COUNTRY BIN database which consists of real data for IP address range 0.0.0.0 to 99.255.255.255. This database contains IP address blocks as key and countries as values. The paid version of IP2Location database covers all IP address ranges. In general, it is more complete, faster and more accurate than using reverse DNS lookups.
Developers can download other sample databases to evaluate other features such as region, city, latitude, longitude, zip code, ISP and domain name using the same Apache module.
IP2Location Apache Module (931.55 kB)
Version: 5.0.0
Linux/Unix
- Download IP2Location C library at here.
- Decompress C library.
tar xvfz ip2location-c-x.x.x.tar.gz - Download and decompress Apache module.
tar xvfz ip2location-apache-x.x.x.tar.gz - Get into working directory.
cd ip2location-apache-x.x.x - Start compilation.
apxs2 -i -a -L /usr/local/lib/ -I ../ip2location-c-x.x.x/libIP2Location/ -l IP2Location -c mod_ip2location.c -
Add following lines into /etc/apache2/apache2.conf
<IfModule mod_ip2location.c> IP2LocationEnable On IP2LocationSetmode <ALL> IP2LocationDBFile <ip2location_binary_db_file_with_fully_qualified_path> </IfModule>
Windows
- Download IP2Location C library at here.
- Decompress C library using 7-zip or other compression tools.
- Download and decompress Apache module.
- Navigate to ip2location-apache-x.x.x folder.
- Edit Makefile.win to change the path for C library.
IP2LOCATION_CSRC_PATH = C:/ip2location-c-x.x.x/libIP2Location
IP2LOCATION_CLIB_PATH = C:/ip2location-c-x.x.x/libIP2Location
APACHE_INSTALL_PATH = "C:/Program Files/Apache Software Foundation/Apachex.x" - Start compilation.
nmake /f Makefile.win - Copy IP2Location_apache.dll generated to Apache modules directory.
-
Add following lines into httpd.conf
<IfModule mod_ip2location.c> IP2LocationEnable On IP2LocationSetmode <ALL> IP2LocationDBFile <ip2location_binary_db_file_with_fully_qualified_path> </IfModule>
RewriteEngine On
RewriteCond %{ENV:IP2LOCATION_COUNTRY_SHORT} ^UK$
RewriteRule ^(.*)$ http://www.google.co.uk [L]
Evaluation version of the database file having limited range of IP address information. You can query all IP addresses from 0.0.0.0 to 99.255.255.255 only.
- IP2Location™ DB1 Sample BIN database (308.92 kB)
- IP2Location™ DB2 Sample BIN database (38.45 MB)
- IP2Location™ DB3 Sample BIN database (10.75 MB)
- IP2Location™ DB4 Sample BIN database (43.54 MB)
- IP2Location™ DB5 Sample BIN database (16.86 MB)
- IP2Location™ DB6 Sample BIN database (50.08 MB)
- IP2Location™ DB7 Sample BIN database (48.64 MB)
- IP2Location™ DB8 Sample BIN database (55.54 MB)
- IP2Location™ DB9 Sample BIN database (18.88 MB)
- IP2Location™ DB10 Sample BIN database (58.38 MB)
- IP2Location™ DB11 Sample BIN database (19.27 MB)
- IP2Location™ DB12 Sample BIN database (58.77 MB)
- IP2Location™ DB13 Sample BIN database (17.80 MB)
- IP2Location™ DB14 Sample BIN database (59.42 MB)
- IP2Location™ DB15 Sample BIN database (20.60 MB)
- IP2Location™ DB16 Sample BIN database (62.02 MB)
- IP2Location™ DB17 Sample BIN database (22.22 MB)
- IP2Location™ DB18 Sample BIN database (67.82 MB)
- IP2Location™ DB19 Sample BIN database (57.30 MB)
- IP2Location™ DB20 Sample BIN database (69.40 MB)
- IP2Location™ DB21 Sample BIN database (22.59 MB)
- IP2Location™ DB22 Sample BIN database (72.02 MB)
- IP2Location™ DB23 Sample BIN database (57.63 MB)
- IP2Location™ DB24 Sample BIN database (72.57 MB)
