cccc nixa nixa... kada postujes tudji kod makar budi siguran da si postovao najnoviju verziju :P a takodje bi bilo lepo da das credit za to :P
Kôd:
function seoDomain($defaultPage = 'index.php')
{
$rest = $reqUri = array();
$loc = 'http://';
$reqUri = explode('/', $_SERVER['REQUEST_URI']);
$rest = explode('.', $_SERVER['HTTP_HOST']);
if ($rest[0] == 'www')
{
unset($rest[0]);
$loc .= implode('.', $rest);
}
else
{
$loc .= $_SERVER['HTTP_HOST'];
}
if(end($reqUri) == $defaultPage)
{
/* since you're unsetting $reqUri[0], count($reqUri) will actually be (count($reqUri) -1) at this point */
unset($reqUri[0], $reqUri[count($reqUri)]);
$loc .= (!empty($reqUri)) ? '/' . implode('/', $reqUri) . '/' : '/';
}
else
{
$loc .= $_SERVER['REQUEST_URI'];
}
return $loc;
}
header("HTTP/1.1 301 Moved Permanently");
header('Location:' . seoDomain());
Inace sve ovo je na mom blogu :P
http://blog.default.co.yu/solving-se...main-problems/