Answer the question
In order to leave comments, you need to log in
How to make HTTP_ACCEPT_LANGUAGE redirect correctly?
Greetings!
Need help!)
There is such a thing, but I would like it to let bots through!
preg_match('/^\w{2}/', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $m);
switch (strtolower($m[0])) {
case 'ru': break;
default: header('Location: /en'); break;
}
Answer the question
In order to leave comments, you need to log in
add a check for "bot|spider|crawler" to HTTP_USER_AGENT, but instead of $_SERVER it's better to use filter_input(INPUT_SERVER, 'HTTP_USER_AGENT')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question