wordpress實現301跳轉的方法:
打開根目錄下的“wp-blog-header.php”文件,在“<?php”后面添加以下代碼:
if (strtolower($_SERVER['SERVER_NAME']) != 'www.123.com')
{
$URIRedirect=$_SERVER['REQUEST_URI'];
if(strtolower($URIRedirect)=="/index.php")
{
$URIRedirect="/";
}
header('HTTP/1.1 301 Moved Permanently');
header('Location:http://www.123.com'.$URIRedirect);
exit();
}