WebPagetest Forums
htaccess help please - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Optimization Discussions (/forumdisplay.php?fid=5)
+--- Thread: htaccess help please (/showthread.php?tid=12343)



htaccess help please - safnah - 06-16-2013 07:45 AM

hi everyone

i wonder if you can help me by setting a rule for each ip from a certain country can be redirected to some sort another sub-domain or a link , anyone can help me please ?


RE: htaccess help please - GreenGecko - 06-17-2013 04:02 PM

Look at mod_geoip2. This makes the country of origin available as GEOIP_COUNTRY_CODE - you can build your rules from that.


RE: htaccess help please - 5vlast - 06-26-2013 05:37 PM

you will need geoip you can find such ip database on you can get it from http://www.ipaddresslocation.org/ip_ranges/get_ranges.php
then you have to setup ur .htaccess to redirect in ip case
# permanently redirect specific IP request for entire site
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_HOST} 22\.22\.22
RewriteRule \.php$ http://subdomain.YOURDOMAINHERE.COM/ [R=301,L]
but in experience it will cost you hard server load i think better to do it in php