IP2Location is a non-intrusive GeoIP solution to help you to identify visitor's geographical location, providing information such as country, region, city, latitude & longitude of city, ZIP code, time zone, connection speed, ISP, domain name, IDD country code, area code, weather station code and name, mobile carrier, elevation and usage type information. IP2Location uses a proprietary IP address lookup database and technology that doesn't invade the Internet user's privacy.
Navigate to LiteSpeed Web Server directory:
cd /usr/local/lsws
Download any sample database from IP2location and save to this directory.
In LSWS WebAdmin, configure the database location. Navigate to Configuration > Server > General > General settings > IP2Location DB
Enter DB File Path:
/usr/local/lsws/IP-COUNTRY-SAMPLE.BIN
Set DB Cache Type to MemoryCache
Navigate to Web Admin > Configurations > Your Virtual Hosts > Rewrite to add rewrite rules that will control the redirect:
<IfModule LiteSpeed> RewriteEngine On RewriteCond %{ENV:IP2LOCATION_COUNTRY_SHORT} ^DE$ RewriteRule ^(.*)$ http://www.google.co.uk [L] </IfModule>
Refer to Ip2location for more rewrite examples.
From this site , we can simply put in a web IP and choose a country from three(USA, Germany, Netherlands). If you want more than three countries, then you need to register for a paid plan.
You can choose a free proxy server from online free resources, e.g. Free_Proxy
Setup the proxy IP with your browser. Here are the steps for Chrome:
Use a proxy server for your LAN…
Navigate to Web Admin > Configurations > Your Virtual Hosts > Rewrite:
Yes
9
.# Redirect two specific countries RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(DE)$ RewriteRule ^(.*)$ https://en.wikipedia.org/wiki/Germany [R,L]
tail -f /PATH_TO_LSWS/log/error.log
When you are using Germany IP:
[REWRITE] Rule: Match '/' with pattern '^(.*)$', result: 2 [REWRITE] Cond: Match 'DE' with pattern '^(DE)$', result: 2 [REWRITE] Source URI: '/' => Result URI: 'https://en.wikipedia.org/wiki/Germany'
When you are using Netherlands IP:
[REWRITE] Rule: Match '/' with pattern '^(.*)$', result: 2 [REWRITE] Cond: Match 'NL' with pattern '^(DE)$', result: -1
Note: 2
is a match, -1
is not a match
nobody
) has read access to the IP2Location database file(s) you are using.