Country Redirection

I want to limit which country can access my web page, but I cannot get it to work.

I tried to follow this guide .

This gives me a lot of errors when it is hosted on my localhost (XAMPP). Check the error in the screenshot:

My image

And if it loads on some free hosting, it gives me an infinite "LOOP" when accessing domain.com/index.php or domain.com/redirect.php .

But on this web page it works and perfectly shows my data (country, country code, latitude, longitude, etc.)

I pasted these two files into the same folder and tried to access my computer, which:

http: //localhost/geoplugin.class/index.php

+5
source share
1 answer

The best way to do this. Use .htaccess

Here is the website that will generate the htaccess country block code:

http://www.ip2location.com/blockvisitorsbycountry.aspx

0
source

Source: https://habr.com/ru/post/1238805/


All Articles