A
A
Alfiya13452016-01-08 18:27:22
PHP
Alfiya1345, 2016-01-08 18:27:22

How, depending on the user's country, to open different pages without a visible redirect?

At the moment, it is implemented by a redirect - depending on the user's country, it redirects to a specific url.
The problem is that depending on the country, the user needs to show different pages, but on the same url.
For example,

  • Russian user goes to test.ru/index.php sees the forum
  • US user on test.ru/index.php sees admin blog

Can this be done via htaccess?
For example:
RewriteCond %{REMOTE_ADDR} !93.143.174.0 
RewriteRule ^index.php$ index2.php [L,QSA]

is it possible to somehow replace a specific ip with a country definition? Or in one file to define the country, and to register in the given design?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2016-01-08
@miraage

You can't rely on IP like that.
I can live in Russia, surf through VPN. It will show you that I am from Germany.

D
Dimonchik, 2016-01-08
@dimonchik2013

for good - a template engine that collects a page from the lang / IP parameter of
course, MVC, routing, the framework
can also be perverted by nginx directives, but it’s more confusing and less manageable
, and Google doesn’t care for this

U
utyfua, 2016-01-08
@utyfua

you can do this:
index.php - select the Russian version (with a link to /ru/index.php, for example) and select english version (with a link to /en/index.php, for example). It is possible to play around with the definition over time and let them go where they need to

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question