小站的地址改为www.77nn.net
发现百度收录了很多以前的地址。修改了.htaccess
发现只能首页跳转,文章页不能跳转。下面就来分享下内容页域名跳转重定向的简单代码吧
1.打开根目录下得wp-blog-header.php,在< ?php后面添加如下代码:
if (strtolower($_SERVER[‘SERVER_NAME’]) != ‘www.77nn.net’){$URIRedirect=$_SERVER[‘REQUEST_URI’];if(strtolower($URIRedirect)==“/index.php”){$URIRedirect=“/”;}header(‘HTTP/1.1 301 Moved Permanently’);header(‘Location:http://www.77nn.net’.$URIRedirect);exit();}if (strtolower($_SERVER[‘SERVER_NAME’]) != ‘www.77nn.net’) { $URIRedirect=$_SERVER[‘REQUEST_URI’]; if(strtolower($URIRedirect)==“/index.php”) { $URIRedirect=“/”; } header(‘HTTP/1.1 301 Moved Permanently’); header(‘Location:http://www.77nn.net’.$URIRedirect); exit(); }if (strtolower($_SERVER[‘SERVER_NAME’]) != ‘www.77nn.net’) { $URIRedirect=$_SERVER[‘REQUEST_URI’]; if(strtolower($URIRedirect)==“/index.php”) { $URIRedirect=“/”; } header(‘HTTP/1.1 301 Moved Permanently’); header(‘Location:http://www.77nn.net’.$URIRedirect); exit(); }
© 版权声明
THE END
暂无评论内容