Skip to navigation
How to redirect web-traffic from specific country ips to another site with .htaccess
01.08.14
example: you like to redirect all chiniese ip trafic to http://www.freetibet.net/ from a debian server 1. install the module and the ip database : apt-get update apt-get install -y geoip-bin geoip-database libgeoip-dev libgeoip1 libapache2-mod-geoip 2. edit the apache module geoip module to load the correct database emacs /etc/apache2/mods-available/geoip.conf may look like this:
GeoIPEnable On GeoIPDBFile /usr/share/GeoIP/GeoIP.dat GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache GeoIPDBFile /usr/share/GeoIP/GeoIP.dat CheckCache GeoIPScanProxyHeaders On
3. edit your .htaccess file it may look like this: GeoIPEnable On RewriteEngine on RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CN$ RewriteRule ^(.*)$ http://www.freetibet.net/$1 [R,L]
http://www.devops.zone/webserver/libapache2-mod-geoip-debian/
Reply
Anonymous
Information Epoch 1746857417
Files are bags of bytes.
Home
Notebook
Contact us