Forum Moderators: phranque

Message Too Old, No Replies

geoip and htaccess

geoip and htaccess

         

georgian

10:23 am on Mar 14, 2011 (gmt 0)

10+ Year Member



Hi I use apache geo-ip and I want to allow users from other countries only to pages such as:

[http:]//[www.]my_domain/forum/

[http:]//[www.]my_domain/forum/viewforum.php?f=

[http:]//[www.]my_domain/forum/viewtopic.php?f=

It is possible with htaccess?

thanks

jdMorgan

12:42 am on Mar 18, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes,

See Apache mod_rewrite. Use a RewriteCond to test the country-code variable provided by geoip, and use the RewriteRule to test the client-requested URL-path. If not an allowable combination of geo-code and requested URL-path, return a 403-Forbidden response or redirect the request as desired.

Jim

georgian

7:38 am on Mar 18, 2011 (gmt 0)

10+ Year Member



You can give me an example?

thanks