To redirect languages, we are currently creating folders in the root directory of websites containing the index.php file, which checks the HTTP_ACCEPT_LANGUAGE server HTTP_ACCEPT_LANGUAGE . e.g. for URL www.example.com/press/
in /var/www/site/press/index.php :
<?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"] == "en") header("location: ../press_en.php"); else header("location: ../press_de.php"); ?>
As the site grows, we now have many such folders. I am trying to clear this by moving the redirects to a single .htaccess file:
RewriteEngine on
The idea is the same as the php file, but it does not work. I tried all possible language settings / orders in Firefox settings and checked the headers were correct, but it always serves for the press_de.php file.
What am I doing wrong, or is there a better way? (not including content negotiation / multivisors or anything that requires renaming files, this is currently not an option).
source share