<?php ob_start(); $lg = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); if ($lg == 'tr') { $git = "http://www.site.com/"; } else { $git = "http://www.site.com/".$lg."/"; } header("Location: $git"); ?>