D
D
Dmitry2014-04-16 16:24:26
PHP
Dmitry, 2014-04-16 16:24:26

How to redirect to another page using a list of IP addresses?

Do you need to redirect from the main page of the site to another if the user entered from an IP address that is not in the specified range?
For example, how do some services like spotify.com do it? The meaning of the redirect is the same, to allow users to visit the site only from a certain country.
What is the best way to do this? Do it on the client or server?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Vasiliev, 2014-04-16
@vasilevkirill

geoip is called such functionality
dev.maxmind.com/geoip

R
Roman no_name, 2014-04-16
@Romastr

It is better to do a redirect on the server.
$_SERVER["REMOTE_ADDR"] - ip address
check if it is included in the array if it is included we give one link if we do not enter the second
one so you can find out the user's country and redirect to the page you need

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question