我想知道我应该用语言重定向发送哪个HTTP状态代码.
我有以下PHP代码通过HTTP标头重定向到Accept-Language浏览器标头中最重要的语言.
<?
$langs = array();
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
if (count($lang_parse[1])) {
// create a list like "en" => 0.8
$langs = array_combine($lang_parse[1], $lang_parse[4]);
// set default to 1 for any without q factor
foreach ($langs as $lang => $val) {
if ($val === '') $langs[$lang] = 1;
}
// sort list based on value
arsort($langs, SORT_NUMERIC);
}
}
// look through sorted list and use first …
Run Code Online (Sandbox Code Playgroud) 我在所有Magento安装中都使用Apache.我想知道我是否应该开始使用Lighttpd或Nginx来提高性能.你怎么看?
编辑1
我见过:
nginx:http: //www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento
lighttpd:http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/installing-with-lighttpd-and-fastcgi