何らかの理由で、一部の人/ブラウザが間違ったページにリダイレクトします。それらは次の宛先に送信されます。
http://www.site.com/page.php/http://www.site.com/page.php
それ以外の:
どうしてこれなの?
Ps。MOD_REWRITE を使用しています。これは違いを生むでしょうか?
リダイレクト機能:
function KT_redir($url) {
$protocol = "http://";
$server_name = $_SERVER["HTTP_HOST"];
if ($server_name != '') {
$protocol = "http://";
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == "on")) {
$protocol = "https://";
}
if (preg_match("#^/#", $url)) {
$url = $protocol.$server_name.$url;
} else if (!preg_match("#^[a-z]+://#", $url)) {
$script = KT_getPHP_SELF();
if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '' && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
$script = substr($script, 0, strlen($script) - strlen($_SERVER['PATH_INFO']));
}
$url = $protocol.$server_name.(preg_replace("#/[^/]*$#", "/", $script)).$url;
}
$url = str_replace(" ","%20",$url);
if (KT_is_ajax_request()) {
header("Kt_location: ".$url);
echo "Redirecting to: " . $url;
} else {
header("Location: ".$url);
}
}
exit;
}
MOD_REWRITE
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC]
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L]